incapacitant
21st April 2006, 12:21
I use the following code to send a request to a server :
int misc::getUrl( const QString & host, const QString & url, QHttp * pHttp, QIODevice * pDevice, const QString & referer )
{
qDebug( "getUrl host=%s url=%s", qPrintable( host ), qPrintable( url ) );
Proxy p = proxy();
if ( p.Enabled )
pHttp->setProxy( p.Host, p.Port, p.Login, p.Password );
pHttp->setHost( host );
QHttpRequestHeader header( "GET", url, 1, 1 );
header.setValue( "Host", host );
if ( !referer.isEmpty() )
header.setValue( "Referer", referer );
header.setContentLength( 0 );
return pHttp->request( header, 0, pDevice );
}
It works very well, trouble is I cannot get the status result of the request that I expect to get through pDevice. I tried pDevice->data(), pDevice.readLine but nothing comes back. The request does what it should do but it won't tell me what it did.
I assume this getUrl stuff is widespread (I got it from some friend), maybe you can tell me or hint at how I could get a status result !!
No need to say that I am NOT an intermediate user, hardly a novice...
int misc::getUrl( const QString & host, const QString & url, QHttp * pHttp, QIODevice * pDevice, const QString & referer )
{
qDebug( "getUrl host=%s url=%s", qPrintable( host ), qPrintable( url ) );
Proxy p = proxy();
if ( p.Enabled )
pHttp->setProxy( p.Host, p.Port, p.Login, p.Password );
pHttp->setHost( host );
QHttpRequestHeader header( "GET", url, 1, 1 );
header.setValue( "Host", host );
if ( !referer.isEmpty() )
header.setValue( "Referer", referer );
header.setContentLength( 0 );
return pHttp->request( header, 0, pDevice );
}
It works very well, trouble is I cannot get the status result of the request that I expect to get through pDevice. I tried pDevice->data(), pDevice.readLine but nothing comes back. The request does what it should do but it won't tell me what it did.
I assume this getUrl stuff is widespread (I got it from some friend), maybe you can tell me or hint at how I could get a status result !!
No need to say that I am NOT an intermediate user, hardly a novice...