cherokee / webserver

Cherokee Web Server
GNU General Public License v2.0
563 stars 104 forks source link

Error handlers need to access more information #112

Open danielniccoli opened 11 years ago

danielniccoli commented 11 years ago

Original author: alobbs (April 12, 2008 22:12:23)

http://www.cherokee-project.com/archive/2005-May/000673.html

As was requested several years ago, there is a serious missing feature in Cherokee. When someone specifies the custom error documents (CGI), the 'original' filename cannot be resolved anymore.

Cherokee should add the following envirionment variables to solve the issue:

Now there is a 'cherokee_handler_cgi_add_env_pair', but I guess that this will not affect the handler_error_redir which is used for the Error Documents. So I guess there should be something in the style of handler_error which a cgi execute method. (I guess a mash up like handler phpcgi.)

Original issue: http://code.google.com/p/cherokee/issues/detail?id=40

danielniccoli commented 11 years ago

From ste...@konink.de on October 31, 2008 13:23:32 REDIRECT_URL; is supported in the patch in the other bug if redirection is set.

danielniccoli commented 11 years ago

From ste...@konink.de on October 31, 2008 16:21:34 Working on it.

danielniccoli commented 11 years ago

From ste...@konink.de on October 31, 2008 17:36:42 Alvaro,

If you can bump the configuration format again, hence I would like to have the show variable also in the handler_error_redir. Then the attached patch will take care of your environment troubles :)

danielniccoli commented 11 years ago

From alobbs on October 31, 2008 18:04:37 The new pieces of the patch looks alright, although I'd suggest you to split it in parts for the next time.

I mean, the patch you have just submitted is a mix of three different bug fixes (one of which has been already applied upstream). Please, from now on, try attach each independent patches to individual bugs; in that way it's much easier to review and discuss if needed.

Anyway, the patch looks good. It doesn't apply to trunk, so I'm doing the modification it by hand. Good job!!! :-)

danielniccoli commented 11 years ago

From ste...@konink.de on October 31, 2008 18:12:05 The problem was I didn't know if the other stuff was already done... but indeed I should have checked it out subversion before starting.

danielniccoli commented 11 years ago

From alobbs on October 31, 2008 18:53:11 r2272 has implemented SERVER_ADDR.

danielniccoli commented 11 years ago

From alobbs on October 31, 2008 19:27:44 r2274 added SERVER_PORT.

danielniccoli commented 11 years ago

From skar...@gmail.com on October 31, 2008 19:42:42 Good job guys! :)

danielniccoli commented 11 years ago

From alobbs on October 31, 2008 19:51:09 r2275 added REMOTE_PORT.

Anyway, do not lose the focus.. We haven't implemented the variables described in the bug report yet. :-)

danielniccoli commented 11 years ago

From ste...@konink.de on October 31, 2008 19:59:46 Except for 'REDIRECT_ERROR_NOTES' everything that was reported + SERVERT_PORT fix was implemented.

danielniccoli commented 11 years ago

From ste...@konink.de on November 01, 2008 05:31:54 This patch basically updates the previous one, less code. But I'm still breaking my head around the respinning of the error message.

Alvaro; how should I go from phase_init -> phase_setup_connection?

danielniccoli commented 11 years ago

From ste...@konink.de on November 01, 2008 06:20:21 Mental note; cherokee_buffer_clean (&conn->web_directory);

                    cherokee_buffer_add_buffer (&conn->request_original,

&conn->request); conn->redirect_method = conn->header.method; cherokee_buffer_add_buffer (&conn->request, &entry->url);

instead of _init.

danielniccoli commented 11 years ago

From alobbs on November 01, 2008 13:10:46 This is probably going to be a tricky bug to fix.. I'll try to give you a hand as soon as I can

danielniccoli commented 11 years ago

From skar...@gmail.com on November 02, 2008 23:49:30 Request to: http://localhost/

[SERVER_PORT] => 80
[SERVER_ADDR] => ::
danielniccoli commented 11 years ago

From ste...@konink.de on November 02, 2008 23:56:56 Sounds very much like IPv6 :)

danielniccoli commented 11 years ago

From alobbs on November 03, 2008 08:31:48 Yeah, that's alright... :: is the contraction of 0000:0000:0000:0000:0000:0000:0000:0000

danielniccoli commented 11 years ago

From skar...@gmail.com on November 03, 2008 08:40:11 From Wikipedia:

Unspecified address

* ::/128 — the address with all zero bits is called the unspecified address. This

address must never be assigned to an interface and is to be used only in software before the application has learned its host's source address appropriate for a pending connection. Routers must not forward packets with the unspecified address.

Link local addresses

* ::1/128 — the loopback address is a unicast localhost address. If an

application in a host sends packets to this address, the IPv6 stack will loop these packets back on the same virtual interface (corresponding to 127.0.0.1 in IPv4).

Then, SERVER_ADDR should be "::" or "::1"?.

danielniccoli commented 11 years ago

From alobbs on November 03, 2008 08:52:29 That's a really good point, indeed. It should be ::1 actually.

danielniccoli commented 11 years ago

From tah...@gmail.com on November 03, 2008 13:30:03 Just a quick note in case someone is interested in the original link.

The mail-archives have changed slightly, and the original message should be available at: http://lists.octality.com/pipermail/cherokee/2005-May/000673.html