Skip to content

Commit

Permalink
Fixes #26. NOAA CO-OPS began using a redirect which caused errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Cobell committed Dec 6, 2016
1 parent 492dd8d commit 4876c32
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion MetOceanViewer_GUI/src/noaa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,20 @@ int noaa::fetchNOAAData()
connect(reply,SIGNAL(finished()),&loop,SLOT(quit()));
connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),&loop,SLOT(quit()));
loop.exec();
this->readNOAAResponse(reply,i,j);
//...Check for a redirect from NOAA. This fixes bug #26
QVariant redirectionTargetURL = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if(!redirectionTargetURL.isNull())
{
QNetworkReply *reply2 = manager->get(QNetworkRequest(redirectionTargetURL.toUrl()));
connect(reply2,SIGNAL(finished()),&loop,SLOT(quit()));
connect(reply2,SIGNAL(error(QNetworkReply::NetworkError)),&loop,SLOT(quit()));
loop.exec();
reply->deleteLater();
this->readNOAAResponse(reply2,i,j);
}
else
this->readNOAAResponse(reply,i,j);

}
}
return 0;
Expand Down

0 comments on commit 4876c32

Please sign in to comment.