Skip to content
Permalink
Browse files
A further speculative fix for trac ticket #8.
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@5697 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
morb_au committed Aug 15, 2006
1 parent 52e80e9 commit 07a42c171af827b2690c9a96a2bb20d07882bd74
Showing with 57 additions and 0 deletions.
  1. +55 −0 src/providers/wms/qgshttptransaction.cpp
  2. +2 −0 src/providers/wms/qgshttptransaction.h
@@ -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 ) ) );

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


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

@@ -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();

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

}


void QgsHttpTransaction::dataStateChanged( int state )
{

@@ -93,6 +93,8 @@ public slots:

void dataFinished( int id, bool error );

void transactionFinished( bool error );

void dataStateChanged( int state );

void networkTimedOut();

0 comments on commit 07a42c1

Please sign in to comment.