I'm coding an application to get information of a device on which I have to send a PUT request like this:
connect(&netman,SIGNAL(finished(QNetworkReply*)), this,
SLOT(reqFinished(QNetworkReply*)));
QByteArray data("0ABF0A25");
QNetworkRequest req(QUrl("http://192.168.1.100:8088"));
req.setHeader(QNetworkRequest::ContentLengthHeader,data.length());
QNetworkReply rep =netman.put(req,data);
connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this,
SLOT(errorSlot(QNetworkReply::NetworkError))):
I know the device is working because it starts its process and if I put a sniffer between my PC and the device and I see the response .
485454502F312E3020323030204F4B200D0A or in plain text 'HTTP/1.0 200 OK \r\n'
but when the slotRequestFinished(QNetworkReply* rep)
slot is executed I get no data, no headers and no attributes, and error code 2 (connection closed).
If i execute:
QVariant attr = rep->attribute(QNetworkRequest::HttpStatusCodeAttribute);
I get and invalid variant object, same for the headers.
How can I get the raw packets of the response? That would be handy for this case.
I also noticed on my sniffer that the connection repeats three times, and sends the request all these times for one only put request; Could that be an issue with the library?