PDA

View Full Version : QHTTP does not see tunneled TCP HTTP OK authentication response



SailingDreams
21st May 2009, 20:27
Hi

I am trying to setup RTSP/RTP tunneled via HTTP. I have sent the request below


GET /axis-media/media.amp?videocodec=h264 HTTP/1.1
Host: 169.xxx.xxx.xxx
Cache-Control: no-cache
Connection: Keep-Alive
x-sessioncookie: 123456789
Authorization: Digest username="root", realm="AXIS_00408C943C65",
nonce="00001c86Y8265782d13f595995eddef04419da03a5abc5",
uri="/axis-media/media.amp?videocodec=h264", response="32ae033bc3a5d10c67efd8c2246716cf",
qop=auth, nc=00000001, cnonce="de29e2a5683f6d43d65435a99ccba54a"

and the server responds with the result that is not carried by HTTP but is in the TCP
segment data show below:


HTTP/1.0 200 OK
Content-Type: application/x-rtsp-tunnelled
Date: Thu, 21 May 2009 17:54:42 GMT

The QHttp seems to be waiting for a HTTP protocol carried "200 OK" message and for some reason cannot see the TCP tunnelled "200 OK" message (waveshark can!!).

I made sure the QAuthenticator was working by deleting the "x-sessioncookie: 123456789" content. When I do this, the server uses HTTP protocol to carry the "200 OK" message and my code proceeds, but without getting tunnelled RTSP setup.

Any thoughts on how to get the Authenticator to see the tunnelled HTTP 200 OK message?

Thanks

wysota
21st May 2009, 22:23
I think you are expecting too much from a simple class such as QHttp. It handles HTTP protocol and HTTP only. You have to fetch the tunnel traffic yourself if you need to.

SailingDreams
22nd May 2009, 17:54
Yiks. I was hoping that QHttp could handle it.

Any recommendations on how to deal with this? I thought of connecting to the QHttp signal readyRead(), but if QT can't see the header in the packet below
because the packet also contains MJpeg data, it may not fire the readyRead(). I know
that signal readyRead() does not fire, so would readyRead() not fire?

If readRead works, then I could parse the TCP segment data and look for the
HTTP 200 OK. But if I find it, I'm not sure how I'd tell QHttp to stop the GET and proceed
with the POST it has in its queue.

The QT documentation says


This signal is emitted when processing the request identified by id has finished. error is true if an error occurred during the processing; otherwise error is false.

What is "processing the request" for a HTTP GET? (what is the event QHttp is looking for?)

Thanks



0000 00 23 ae 12 da a9 00 40 8c 94 3c 65 08 00 45 00 .#.....@..<e..E.
0010 05 dc 62 6c 40 00 40 06 52 d0 a9 fe b1 54 a9 fe ..bl@.@.R....T..
0020 7a 8e 00 50 0a a6 0b 2b b8 6e 2f 21 e8 1b 50 10 z..P...+.n/!..P.

TCP segment data starts here.
||
V
????? Why can't QHTTP see this HTTP response???????
0030 19 20 c9 fc 00 00 48 54 54 50 2f 31 2e 30 20 32 . ....HTTP/1.0 2
0040 30 30 20 4f 4b 0d 0a 43 61 63 68 65 2d 43 6f 6e 00 OK..
Cache-Con
0050 74 72 6f 6c 3a 20 6e 6f 2d 63 61 63 68 65 0d 0a trol: no-cache..
0060 50 72 61 67 6d 61 3a 20 6e 6f 2d 63 61 63 68 65 Pragma: no-cache
0070 0d 0a 45 78 70 69 72 65 73 3a 20 54 68 75 2c 20 ..Expires: Thu,
0080 30 31 20 44 65 63 20 31 39 39 34 20 31 36 3a 30 01 Dec 1994 16:0
0090 30 3a 30 30 20 47 4d 54 0d 0a 43 6f 6e 6e 65 63 0:00 GMT..Connec
00a0 74 69 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 43 6f 6e tion: close..Con
00b0 74 65 6e 74 2d 54 79 70 65 3a 20 6d 75 6c 74 69 tent-Type: multi
00c0 70 61 72 74 2f 78 2d 6d 69 78 65 64 2d 72 65 70 part/x-mixed-rep
00d0 6c 61 63 65 3b 20 62 6f 75 6e 64 61 72 79 3d 6d lace; boundary=m
00e0 79 62 6f 75 6e 64 61 72 79 0d 0a 0d 0a 2d 2d 6d yboundary....--m
00f0 79 62 6f 75 6e 64 61 72 79 0d 0a 43 6f 6e 74 65 yboundary..Conte
0100 6e 74 2d 54 79 70 65 3a 20 69 6d 61 67 65 2f 6a nt-Type: image/j
0110 70 65 67 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e peg..Content-Len
0120 67 74 68 3a 20 31 32 30 36 33 0d 0a 0d 0a ff d8 gth: 12063......
0130 ff e0 00 10 4a 46 49 46 00 01 02 00 00 0b 00 0a ....JFIF........
0140 00 00 ff fe 00 0f 0a 01 4a 16 ce c2 4a 4a 16 ce ........J...JJ.

wysota
22nd May 2009, 20:29
Any recommendations on how to deal with this?
I know nothing of tunneling raw data like this, so no :)


What is "processing the request" for a HTTP GET? (what is the event QHttp is looking for?)

Request processing is finished when QHttp has received the full response from the server.

SailingDreams
23rd May 2009, 00:38
I used the readResponseHeader() signal and it was able to read the response header for the HTTP GET I requested. Unfortunately the HTTP state is still stuck in state "reading". Which means (I think) that it will not process the next que'd HTTP request. I'd like get the HTTP state to "closed" so that I can let QHTTP do the next command in its queue.

I am worried though that if I use the "QHttp::close()" command, my TCP connection will also be closed and bye bye to my streaming video.

Any ideas how to get the QHttp to send the next request without closing the TCP session that was setup for the GET? (the TCP session stays open from the GET to receive the streaming video).



void VideoInterfaceRealAxis282MJpeg::readResponseHeader (const QHttpResponseHeader
&responseHeader)
{
switch (responseHeader.statusCode()) {
case 200: // Ok
qDebug("HTTP Header status 200 (OK) found");
break;

default:
break;
}
}

wysota
23rd May 2009, 01:48
It might be easier if you provide your own implementation of QHttp. You can reuse some of the utility classes such as QHttpRequestHeader. Also have a look at QNetworkAccessManager.

SailingDreams
23rd May 2009, 09:39
Thanks. I'll look at those.