W3C home > Mailing lists > Public > www-archive@w3.org > February 2013

Re: HTTP redirects

From: Karl Dubost <karl@la-grange.net>
Date: Wed, 27 Feb 2013 15:15:56 -0500
Cc: Anne van Kesteren <annevk@annevk.nl>, Mark Nottingham <Mnot@mnot.net>, www-archive <www-archive@w3.org>
Message-Id: <570CD9FC-0133-490B-86E1-F9AFE5F53F2F@la-grange.net>
To: Julian Reschke <julian.reschke@gmx.de>
Julian,

Le 27 févr. 2013 à 13:55, Julian Reschke a écrit :
> I think it would be great if UAs would converge in ignoring broken header fields like these.



# Apache Configuration

On the server side, Apache behaves well, if you try to set multiple location, it takes the *last one*.

<files from.txt>
Header set Location "http://github.com/http2"
Header set Location "http://www.w3.org/"
</files>


# Server Code 

I have created a small test server using python.

=======================================
#!/usr/bin/env python3.3

import http.server


class Httphandler(http.server.BaseHTTPRequestHandler):
    "class"
    def do_GET(self):
        self.send_response(301)
        self.send_header('Location', 'http://www.w3.org/')
        self.send_header('Location', 'https://github.com/karlcow/')
        self.end_headers()
        self.wfile.write('Response body\n')
        return

if __name__ == '__main__':
    addr = ('', 9000)
    http.server.HTTPServer(addr, Httphandler).serve_forever()
========================================

So the server is sending:

HTTP/1.0 301 Moved Permanently
Server: BaseHTTP/0.6 Python/3.3.0
Date: Wed, 27 Feb 2013 20:06:51 GMT
Location: http://www.w3.org/
Location: http://www.github.com/karlcow/

# Browsers Results

* Firefox 20     Corrupted Content Error
* Opera   12.14  Redirects to http://www.w3.org/
* Curl    7.21.4 Redirects to http://www.w3.org/
* Safari  6.0.2  Redirects to http://www.w3.org/

If someone else could test with Chrome and IE.


[1] curl --location-trusted localhost:9000

btw Anne, for curl limit of redirections.	

"By default, the limit is set to 50 redirections. Set this option to -1 to make it limitless."


-- 
Karl Dubost
http://www.la-grange.net/karl/
Received on Wednesday, 27 February 2013 20:16:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 February 2013 20:16:12 GMT