Re: How to make libsoup read from an already-open stream?



On 5/30/2012, Dan Winship wrote:
>> On 05/29/2012 05:48 PM, Trev wrote:
>>> At a certain point in my program, I have bytes coming in on a
>>> GPollableInputStream, and I've read enough of them into memory to
>>> be able to know that I want to parse the stream as an HTTP response.
>>> How can I inject the stream (and the bytes already taken from it) into
>>> libsoup, to have it parsed as a SoupMessageBody?
>>
>> There's no way to do that (other than what you suggested).
>>
>> What exactly are you doing? There might be some other way to go about it
>> that would work...
>>
>> -- Dan

Processing a WebSocket response that doesn't include a protocol switch.

Here's the relevant part of RFC 6455:

   Any status code other than 101 indicates that the WebSocket handshake
   has not completed and that the semantics of HTTP still apply.

and here's an example transaction:

|> GET /application/pushimgsel/process HTTP/1.1
|> Host: play-push-imgsel.herokuapp.com
|> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0
|> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|> Accept-Language: en-us,en;q=0.5
|> Accept-Encoding: gzip, deflate
|> Connection: keep-alive, Upgrade
|> Sec-WebSocket-Version: 13
|> Origin: http://play-push-imgsel.herokuapp.com
|> Sec-WebSocket-Key: vPcC8BX7KxZJU25Ds5Gzkg==
|> Pragma: no-cache
|> Cache-Control: no-cache
|> Upgrade: websocket
|
|< HTTP/1.1 404 Not Found
|< Content-Type: text/html; charset=utf-8
|< Server: Play! Framework;1.2.4;prod
|< Content-Length: 332
|< Connection: keep-alive
|<
|< <!DOCTYPE html>
|<
|< <html>
|<     <head>
|<         <title>Not found</title>
|<         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|<     </head>
|<     <body>
|<                             <h1>Not found</h1>
|<             <p>
|<                 GET /application/pushimgsel/process
|<             </p>
|<             </body>
|< </html>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]