- From: Stuart Myles <smyles@wsj.dowjones.com>
- Date: Thu, 25 Feb 1999 16:08:28 -0500
- To: "www-lib@w3.org" <www-lib@w3.org>
- CC: Stuart Myles <smyles@wsj.dowjones.com>
I am trying to use libwww to access an application server that requires a somewhat modified version of HTTP/1.1. As part of this effort, I need to understand how to handle 101 response codes, i.e. "Switching Protocols" messages. In particular, for performance reasons, I need to tell the server to switch to its "optimized header" mode. This is meant to work as follows: 1. I send it a request which also contains a header requesting the optimized header mode. 2. The server returns a 101 "Switching Protocols" message (to acknowledge my optimized header mode request). 3. It then returns another response, which is the response to my first query. 4. My client and the server then proceed to exchange requests and responses, all with the optimized headers. (In fact, since we are using HTTP 1.1 style pipelining of requests, I can send the subsequent requests before the server responds to my first request). My question is - how can I handle the 101 Switching Protocols message? At present, I send the request and the 101 message gets treated as an Error that terminates my request. Consequently, when the actual response to my query comes along, it gets discarded as bad data. I've figured out that the HTTPInformation function (in HTTP.c) is determining that 101 is a "Switching Protocols" message. And that the "stream_pipe" function is the one that calls HTTPInformation. Interestingly, there is a comment just before the call to HTTPInformation: /* ** If it is a 1xx code then find out what to do and return until we ** get the next code. In the case of Upgrade we may not get back here ** at all. If we are uploading an entity then continue doing that */ if (me->status/100 == 1) { if (HTTPInformation(me) == YES) { "In the case of an Upgrade we may not get back here at all". I guess this means that there is something that I can do to handle this Upgrade message, but I am at a loss to know what it is I'm meant to do! I've tried looking for any references to HT_Upgrade or 101 anywhere in the sources or examples, but I can't find any. Can anyone give me any clues as to how I could handle this type of message? Do I need to create a new Protocol object? Thanks in advance for any help! Stuart -- Stuart Myles -- smyles@wsj.com -- 609-520-7147 -- http://wsj.com
Received on Thursday, 25 February 1999 16:00:46 UTC