Reverse HTTP

From Second Life Wiki
Revision as of 13:17, 13 May 2008 by Donovan Linden (talk | contribs) (New page: Reverse HTTP is an experimental protocol which takes advantage of the HTTP/1.1 Upgrade: header to turn one HTTP socket around. When a client makes a request to a server with the Upgrade: P...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Reverse HTTP is an experimental protocol which takes advantage of the HTTP/1.1 Upgrade: header to turn one HTTP socket around. When a client makes a request to a server with the Upgrade: PTTH/1.0 header, the server may respond with an Upgrade: PTTH/1.0 header, after which point the server starts using the socket as a client, and the client starts using the socket as a server. There is also a COMET-style protocol which will work with HTTP/1.0 or 1.1 clients that do not know how to perform this upgrade.

Below is an example transcript using Reverse HTTP. Lines beginning with > are traffic from the client to the server. Lines beginning with < are traffic from the server to client.

>POST / HTTP/1.1
>Host: localhost:9999
>Accept-Encoding: identity
>Upgrade: PTTH/1.0
>
<HTTP/1.1 101 Switching Protocols
<Content-type: text-plain
<Upgrade: PTTH/1.0
<Date: Tue, 13 May 2008 20:14:45 GMT
<Content-Length: 0
<
<GET / HTTP/1.1
<Host: 127.0.0.1:65331
<Accept-Encoding: identity
<accept: text/plain;q=1,*/*;q=0
<
>HTTP/1.1 200 OK
>Content-type: text-plain
>Date: Tue, 13 May 2008 20:14:45 GMT
>Content-Length: 15
>
>rdlrow ,olleH
>