Hello,
I need to post several HTTP requests to some broken server. The server is unable to process more than 1 request in 1 connection, it simply won't respond.
Terminating the connection seems to be the best solution:
header.setRequest("POST", url.path(), 1, 0); // way #1 - force HTTP/1.0
header.addValue("Connection", "close"); // way #2 - force connection close
// some other code
m_http.request(...);
QHttpRequestHeader header;
header.setRequest("POST", url.path(), 1, 0); // way #1 - force HTTP/1.0
header.addValue("Connection", "close"); // way #2 - force connection close
// some other code
m_http.request(...);
To copy to clipboard, switch view to plain text mode
The server really does terminate connection when using HTTP/1.0 or Connection: close, but QT doesn't like it. After sending first request (and receiving response) I can't send any more using the same QHttp object.
My request never gets processed and I get this error in the console output:
QSocketNotifier: Invalid socket specified
QSocketNotifier: Internal error
To copy to clipboard, switch view to plain text mode
Fortunately, I am able to workaround this problem just by setting new socket before every request:
m_http.setSocket(new QTcpSocket);
To copy to clipboard, switch view to plain text mode
...but I still think that this isn't right - QT shouldn't generate Internal errors. Am I right and this should be fixed?
Bookmarks