HTTP 3xx response

Doug Bagley <>
Mon Nov 6 18:56:29 CET 2000


Peter Andersson <> writes:
> Hi folks,
> 
> I've been playing around with Joe's contributed WWW tools a bit. Fascinating
> what you can do with only a few lines of Erlang code using this library! I have
> a question, though, which I hope is easy to answer for anyone who has programmed
> web client applications before (which I haven't). 
> 
> When you get an HTTP 3xx (e.g. 302) response which indicates a URI redirection,
> it states in RFC1945 that you will get a reference to the new URL in the "entity
> body" of the response. The RFC also explains that you will only get an entity
> body in the response if you explicitly request for it. What I can't figure out
> is what the request should look like. As far as I understand it should be a
> normal HTTP GET with an "entity header" on some relevant format. I've tried a
> few different variants of such a header without success.
> 
> Anyone!?

As a practical matter, I believe it doesn't really matter what's in
the client request, beyond being HTTP/1.0 or better.

Client requests a page:

GET / HTTP/1.0<CRLF>
<CRLF>

Servers return "redirects" with a response like this:

HTTP/1.0 302 Moved Temporarily<CRLF>
Date: Mon, 06 Nov 2000 17:52:16 GMT<CRLF>
Server: Apache/1.3.12 (TRS-80) mod_perl/1.22<CRLF>
Location: http://some.other.place/you/should/go/to<CRLF>
Content-Type: text/html; charset=iso-8859-1<CRLF>
Connection: close<CRLF>
<CRLF>
(there may be some optional HTML content here)

Your client will want to now go to the URL in the Location header

Cheers,
Doug



More information about the erlang-questions mailing list