PDA

View Full Version : Sending information to server over an open HTTP connection



Pieter from Belgium
28th August 2013, 09:37
We are using QNetworkAccessManager to set up the GET request and use the returned QNetworkReply to read the data stream. This works fine.
We tried to send extra information over this open connection by using the QNetworkReply::write method, but this fails as QNetworkReply is read-only.
(We know that this is probably an HTTP limitation, but our application requires to do so.)

Does anybody have an idea on how to send data over the open connection?

(Context: We are building an Ntrip client. Communication to the server happens over HTTP. The server replies to the GET request with an ongoing stream of data. In Ntrip, the client can (repeatedly) send during this ongoing communication extra information to the server in order to finetune the data to be replied.)

wysota
28th August 2013, 10:24
In Ntrip, the client can (repeatedly) send during this ongoing communication extra information to the server in order to finetune the data to be replied.
Using what protocol? GET does not allow any data past the header.

Pieter from Belgium
28th August 2013, 13:38
We use HTTP GET.

We are hoping for a suggestion to bypass this restriction, as the application needs to send updates to the Ntrip caster.

wysota
28th August 2013, 13:43
Could you post an example message exchange between a working server and client where the client transmits a request body with a GET request? In specific, how does the client inform the server about the length of such request body? What encoding does it use for the body?

Pieter from Belgium
28th August 2013, 14:57
The header:
------------------------------------
GET /mountpoint HTTP/1.1
Host: some.ntrip.caster
Ntrip-Version: Ntrip/2.0
User-Agent: NTRIP client X/1.0
Connection: close
-----------------------------------------
<some time later>

$GPGGA,135155.00,5050.89389,N,00443.90698,E,5,19,0 .6,81.53,M,47.39,M,27.9,0268*46

wysota
28th August 2013, 15:37
How does the server determine where the request ends?

Basically I think your only choice is to implement your own client from scratch based on QTcpSocket as what you require does not conform to HTTP/1.1 standards. The syntax is fine but the semantics are not, QNetworkAccessManager is not going to handle that for you without heavy workarounds.