Skip to content

Commit

Permalink
A further speculative fix for trac ticket #8.
Browse files Browse the repository at this point in the history
QgsHttpTransaction needed to wait for the done() signal from QHttp, not just requestFinished().  When QHttp::setProxy() was called, it actually triggered its own QHttp request (before QHttp::get()).  Previously QgsHttpTransaction interpreted the requestFinished() from setProxy() as the requestFinished() from get(), therefore not actually doing anything when a proxy was used.

I cannot test until a Windows build is available based on this commit (or somebody else can confirm instead and update #8 appropriately).



git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5697 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
morb_au committed Aug 15, 2006
1 parent 95722bb commit ef6e0dc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/providers/wms/qgshttptransaction.cpp
Expand Up @@ -139,6 +139,9 @@ bool QgsHttpTransaction::getSynchronously(QByteArray &respondedContent, int redi
connect(http, SIGNAL( requestFinished ( int, bool ) ),
this, SLOT( dataFinished ( int, bool ) ) );

connect(http, SIGNAL( done ( bool ) ),
this, SLOT( transactionFinished ( bool ) ) );

connect(http, SIGNAL( stateChanged ( int ) ),
this, SLOT( dataStateChanged ( int ) ) );

Expand Down Expand Up @@ -313,6 +316,7 @@ void QgsHttpTransaction::dataProgress( int done, int total )
emit setStatus( status );
}


void QgsHttpTransaction::dataFinished( int id, bool error )
{

Expand Down Expand Up @@ -348,6 +352,56 @@ void QgsHttpTransaction::dataFinished( int id, bool error )
}
#endif

// Don't do this here as the request could have simply been
// to set the hostname - see transactionFinished() instead

// // TODO
// httpresponse = http->readAll();
//
// #ifdef QGISDEBUG
// std::cout << "QgsHttpTransaction::getSynchronously: Setting httpactive = FALSE" << std::endl;
// #endif
// httpactive = FALSE;

}


void QgsHttpTransaction::transactionFinished( bool error )
{

#ifdef QGISDEBUG
std::cout << "QgsHttpTransaction::transactionFinished"
<< "." << std::endl;

// // The signal that this slot is connected to, QHttp::requestFinished,
// // appears to get called at the destruction of the QHttp if it is
// // still working at the time of the destruction.
// //
// // This situation may occur when we've detected a timeout and
// // we already set httpactive = FALSE.
// //
// // We have to detect this special case so that the last known error string is
// // not overwritten (it should rightfully refer to the timeout event).
// if (!httpactive)
// {
// std::cout << "QgsHttpTransaction::dataFinished - http activity loop already FALSE." << std::endl;
// return;
// }

if (error)
{
std::cout << "QgsHttpTransaction::transactionFinished - however there was an error." << std::endl;
std::cout << "QgsHttpTransaction::transactionFinished - " << http->errorString().toLocal8Bit().data() << std::endl;

mError = QString( tr("HTTP transaction completed, however there was an error: %1") )
.arg( http->errorString() );
}
else
{
std::cout << "QgsHttpTransaction::transactionFinished - no error." << std::endl;
}
#endif

// TODO
httpresponse = http->readAll();

Expand All @@ -358,6 +412,7 @@ void QgsHttpTransaction::dataFinished( int id, bool error )

}


void QgsHttpTransaction::dataStateChanged( int state )
{

Expand Down
2 changes: 2 additions & 0 deletions src/providers/wms/qgshttptransaction.h
Expand Up @@ -93,6 +93,8 @@ public slots:

void dataFinished( int id, bool error );

void transactionFinished( bool error );

void dataStateChanged( int state );

void networkTimedOut();
Expand Down

0 comments on commit ef6e0dc

Please sign in to comment.