Re: Redirection not working with nethttpd
Paolo Donadeo <[email protected]> Tue, 11 Aug 2009 21:55:46 +0200
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
> If the Location header starts with "/", Nethttpd tries to do an > "internal" redirect--that is, to rewrite the request and process it > directly, instead of returning a 302 response to the client. Ok, I see. And, as expected: > I think you can fix it by giving a full URL in the Location header in this code: this solves the problem. In any case, I remain dubious about the nature of this behavior: bug or feature? :-) I think "internal redirection" is a good feature and I don't think this is the way it is supposed to work. > The exception you see is raised in nethttpd_reactor.ml, apparently > because the response has already been partially written. Possibly if > you really want an internal redirect you aren't supposed to commit the > channel? If I don't commit the channel another exception is raised: [test server] [err] [127.0.0.1] [POST /post_url] Nethttpd: Missing response, replying 'Server Error' I believe this is correct: this is exactly the same exception you get when you forget to commit the channel. The server tries to process the response and finds it empty, so the exception. As a quick fix I'll send the full redirection path back to the client, but I still think i miss something. -- Paolo ~ ~ :wq ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july