QNetworkAccessManager: put request uncomplete on localhost
-
Hi
For a REST client/server solution I try to usethe QNetworkAccessManager::put() method for HTTP PUT requests in the client app. The server receives only the HTTP header but no content data (ca. 2500 bytes) if both runs on the same machine (localhost). Content length is correct in the received HTTP header. The server app uses the QTcpServer class. It receives the header twice (after time out for content) from the client but no content data. I got no error value and GET requests works fine.
With two different machines the put request works like expected. With a Java REST test application put request works fine on localhost.
This occurs on Windows and Linux.Any ideas?
Thanks
Bernd -
The code:
@QNetworkRequest request;
request.setUrl(url);
if(!szUserAgent.isEmpty())
{
request.setRawHeader("User-Agent", szUserAgent.toAscii());
}
if(!szAcceptEncoding.isEmpty())
{
request.setRawHeader("Accept-Encoding", szAcceptEncoding.toAscii());
}
if(!szContentType.isEmpty())
{
request.setHeader(request.ContentTypeHeader, szContentType);m_pReply = m_manager->put(request, baContent);
if(m_pReply != 0L)
{
connect(m_pReply, SIGNAL(error ( QNetworkReply::NetworkError)), this, SLOT( PutRequestError(QNetworkReply::NetworkError)));
connect(m_pReply, SIGNAL( uploadProgress ( qint64 , qint64)), this, SLOT( PutRequestUploadProgress ( qint64 , qint64)));
QNetworkReply::NetworkError error = m_pReply->error();
if(error == QNetworkReply::NoError)
{
...
}@The baContent is a QByteArray with XML content.
Is it possible to log localhost network traffic? I thought it is only possible with real network traffic. But I have only exerience with Wireshark on Windows. I will try to get a log.
-
There is nothing only a debug messages and set a return value for the method. I added this after I saw that it doesn't work. I thought that maybe I get an error right after the call that helps me.
Could the live time of the content QByteArray be a problem?