benluteijn / cherokee

Automatically exported from code.google.com/p/cherokee
0 stars 1 forks source link

cgi document_root in virtual server is ignored *after* an internal redirect #241

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See the htdocs/cgi-bin part.

vserver!20!directory_index = index.php,index.html
vserver!20!document_root = /home/dogomaps/net/htdocs
vserver!20!domain!1 = dogomaps.net
vserver!20!domain!2 = *.dogomaps.net
vserver!20!keepalive = 1
vserver!20!logger = combined
vserver!20!logger!access!buffsize = 16384
vserver!20!logger!access!filename = /home/dogomaps/net/logs/cherokee.access
vserver!20!logger!access!type = file
vserver!20!logger!error!filename = /home/dogomaps/net/logs/cherokee.error
vserver!20!logger!error!type = file
vserver!20!nick = dogomaps.net
vserver!20!rule!400!encoder!deflate = 0
vserver!20!rule!400!encoder!gzip = 0
vserver!20!rule!400!handler = redir
vserver!20!rule!400!handler!rewrite!1!regex = wms/(.*)$
vserver!20!rule!400!handler!rewrite!1!show = 0
vserver!20!rule!400!handler!rewrite!1!substring =
/cgi-bin/mapserv?map=/home/dogomaps/net/mapfiles/$1.map&SERVICE=WMS&
vserver!20!rule!400!match = request
vserver!20!rule!400!match!final = 0
vserver!20!rule!400!match!request = /wms/(.*)$
vserver!20!rule!400!only_secure = 0
vserver!20!rule!300!encoder!gzip = 1
vserver!20!rule!300!handler = fcgi
vserver!20!rule!300!handler!balancer = round_robin
vserver!20!rule!300!handler!balancer!source!1 = 1
vserver!20!rule!300!match = extensions
vserver!20!rule!300!match!extensions = php
vserver!20!rule!300!match!final = 1
vserver!20!rule!200!document_root = /home/dogomaps/net/cgi-bin/
vserver!20!rule!200!encoder!deflate = 0
vserver!20!rule!200!encoder!gzip = 0
vserver!20!rule!200!handler = cgi
vserver!20!rule!200!handler!check_file = 1
vserver!20!rule!200!handler!error_handler = 0
vserver!20!rule!200!handler!pass_req_headers = 0
vserver!20!rule!200!handler!xsendfile = 0
vserver!20!rule!200!match = directory
vserver!20!rule!200!match!directory = /cgi-bin
vserver!20!rule!200!match!final = 1
vserver!20!rule!200!only_secure = 0
vserver!20!rule!100!handler = common
vserver!20!rule!100!handler!iocache = 0
vserver!20!rule!100!match = default
vserver!20!rule!100!match!final = 1

       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=400
    rule_request.c:0074 (                         match): Request
"/cgi-bin/mapserv?map=/home/dogomaps/net/mapfiles/test.map&SERVICE=WMS&"
didn't match with "/wms/(.*)$
"
       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=300
       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=200
  rule_directory.c:0097 (                         match): Match!
rule=/cgi-bin req=/cgi-bin/mapserv web_directory=/cgi-bin: ret_ok
       rule_list.c:0110 (      cherokee_rule_list_match): Merging rule prio=200
       rule_list.c:0120 (      cherokee_rule_list_match): Final rule
prio=200. Exiting.
      connection.c:1937 (cherokee_connection_set_keepalive): Keep-alive 500
      connection.c:2024 (cherokee_connection_open_request):
web_directory='/cgi-bin' request='/cgi-bin/mapserv'
local_directory='/home/dogomaps/net/htdocs'
handler_cgi_base.c:0719 (cherokee_handler_cgi_base_extract_path): Pathinfo:
'(null)'
handler_cgi_base.c:0722 (cherokee_handler_cgi_base_extract_path):
Executable: '/home/dogomaps/net/htdocs/cgi-bin/mapserv'
      connection.c:0400 (cherokee_connection_setup_error_handler): New
handler error
          thread.c:0597 (    process_active_connections): thread
(0x1b241c0) processing conn (0x1b26b70), phase 7 'Init connection'
          thread.c:0653 (    process_active_connections): conn on phase
n=7: Init connection
      connection.c:2024 (cherokee_connection_open_request):
web_directory='/cgi-bin' request='/cgi-bin/mapserv'
local_directory='/home/dogomaps/net/htdocs/'
          socket.c:0960 (      cherokee_socket_bufwrite): write fd=18
len=208 ret=0 written=208
          socket.c:0960 (      cherokee_socket_bufwrite): write fd=18
len=277 ret=0 written=277
          thread.c:0597 (    process_active_connections): thread
(0x1b241c0) processing conn (0x1b26b70), phase 12 'Lingering close'
          thread.c:0653 (    process_active_connections): conn on phase
n=12: Lingering close
      connection.c:1010 (cherokee_connection_linger_read): eof
      connection.c:1010 (cherokee_connection_linger_read): eof
            util.c:1229 (             cherokee_fd_close): fd=18 re=0
          socket.c:0211 (         cherokee_socket_close): fd=18 is_tls=0 re=0
      connection.c:0337 (     cherokee_connection_clean): conn 0x1b26b70,
has headers 0

Original issue reported on code.google.com by ste...@konink.de on 24 Nov 2008 at 2:29

GoogleCodeExporter commented 9 years ago
In short; I really need this redirect. I don't want to put my cgi-bin directory
beneath htdocs, but side by side. 

It seems that /wms/ that is correctly mapped to /cgi/bin/mapserv gets somehow
attached to the docroot of 20 where it should be matched to rule 200.

Any suggestion appreciated! I need this to migrate an existing server 
architecture to
cherokee...

Original comment by milovand...@gmail.com on 27 Nov 2008 at 9:45

GoogleCodeExporter commented 9 years ago
This patch works for me. What do you think about it?.

Original comment by skar...@gmail.com on 28 Nov 2008 at 1:07

Attachments:

GoogleCodeExporter commented 9 years ago
The patch seems to be elegant, but I don't see it solving the problem...

       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=500
  rule_directory.c:0051 (                         match): Match directory: rule=/test
req=/cgi-bin/mapserv: (str) ret_not_found
       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=400
    rule_request.c:0074 (                         match): Request
"/cgi-bin/mapserv?map=/home/dogomaps/net/mapfiles/test.map&SERVICE=WMS&" didn't 
match
with "/wms/(.*)$"
       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=300
       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=200
  rule_directory.c:0097 (                         match): Match! rule=/cgi-bin
req=/cgi-bin/mapserv web_directory=/cgi-bin: ret_ok
       rule_list.c:0110 (      cherokee_rule_list_match): Merging rule prio=200
       rule_list.c:0120 (      cherokee_rule_list_match): Final rule prio=200. Exiting.
      connection.c:1937 (cherokee_connection_set_keepalive): Keep-alive 500
      connection.c:2024 (cherokee_connection_open_request): web_directory='/cgi-bin'
request='/cgi-bin/mapserv' local_directory='/home/dogomaps/net/htdocs'
handler_cgi_base.c:0719 (cherokee_handler_cgi_base_extract_path): Pathinfo: 
'(null)'
handler_cgi_base.c:0722 (cherokee_handler_cgi_base_extract_path): Executable:
'/home/dogomaps/net/htdocs/cgi-bin/mapserv'
      connection.c:0400 (cherokee_connection_setup_error_handler): New handler error
          thread.c:0597 (    process_active_connections): thread (0x11f85d0)
processing conn (0x125fc50), phase 7 'Init connection'
          thread.c:0653 (    process_active_connections): conn on phase n=7: Init
connection
      connection.c:2024 (cherokee_connection_open_request): web_directory='/cgi-bin'
request='/cgi-bin/mapserv' local_directory='/home/dogomaps/net/htdocs/'
          socket.c:0960 (      cherokee_socket_bufwrite): write fd=20 len=208 ret=0
written=208
          socket.c:0960 (      cherokee_socket_bufwrite): write fd=20 len=277 ret=0
written=277
          thread.c:0597 (    process_active_connections): thread (0x11f85d0)
processing conn (0x125fc50), phase 12 'Lingering close'
          thread.c:0653 (    process_active_connections): conn on phase n=12:
Lingering close
      connection.c:1010 (cherokee_connection_linger_read): eof
      connection.c:1010 (cherokee_connection_linger_read): eof
            util.c:1229 (             cherokee_fd_close): fd=20 re=0
          socket.c:0211 (         cherokee_socket_close): fd=20 is_tls=0 re=0
      connection.c:0337 (     cherokee_connection_clean): conn 0x125fc50, has headers 0

As you see here: /home/dogomaps/net/htdocs/cgi-bin/mapserv
The /cgi-bin/mapserv is taken from the *normal* document root. Not the explicit
document root found in the handler configuration:

/home/dogomaps/net/cgi-bin/

Original comment by ste...@konink.de on 28 Nov 2008 at 2:52

GoogleCodeExporter commented 9 years ago
:-????. Works for me...

       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=800
    rule_request.c:0074 (                         match): Request
"/cgi-bin/mapserv?map=/home/dogomaps/net/mapf
iles/hello.map&SERVICE=WMS&" didn't match with "/wms/(.*)$"
       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=700
       rule_list.c:0092 (      cherokee_rule_list_match): Trying rule prio=600
  rule_directory.c:0097 (                         match): Match! rule=/cgi-bin
req=/cgi-bin/mapserv web_directory=/cgi-bin: ret_ok
       rule_list.c:0110 (      cherokee_rule_list_match): Merging rule prio=600
       rule_list.c:0120 (      cherokee_rule_list_match): Final rule prio=600. Exiting.
      connection.c:1937 (cherokee_connection_set_keepalive): Keep-alive denied
      connection.c:2041 (cherokee_connection_open_request): web_directory='/cgi-bin'
request='/mapserv' local_directory='/home/aperez/cgi-bin'
handler_cgi_base.c:1066 (cherokee_handler_cgi_base_split_pathinfo): Pathinfo 
'(null)'
handler_cgi_base.c:0729 (cherokee_handler_cgi_base_extract_path): Pathinfo: 
'(null)'
handler_cgi_base.c:0732 (cherokee_handler_cgi_base_extract_path): Executable:
'/home/aperez/cgi-bin/mapserv'
     handler_cgi.c:0489 (      manage_child_cgi_process): About to execute:
'/home/aperez/cgi-bin/mapserv'
     handler_cgi.c:0494 (      manage_child_cgi_process): No Effective directory
     handler_cgi.c:0669 (     fork_and_execute_cgi_unix): pid 8712
     handler_cgi.c:0446 (     cherokee_handler_cgi_init): finishing ret_ok
     handler_cgi.c:0090 (                 read_from_cgi): read... ret=0 35
     handler_cgi.c:0098 (                 read_from_cgi): 35 bytes read
handler_cgi_base.c:0834 (                  parse_header): CGI header: 
'Content-type:
text/html
'

Anyway, I'm not sure if this patch is the better option to solve this issue... 
Alvaro?.

Original comment by skar...@gmail.com on 28 Nov 2008 at 7:22

GoogleCodeExporter commented 9 years ago
It makes good sense for me. I'm applying it.
Thank you guys! :-)

Original comment by alobbs on 28 Nov 2008 at 10:02

GoogleCodeExporter commented 9 years ago
Oops! Nop.. my bad.
Antonio, it's your patch, so you are applying it.

Please, go ahead. Good job! :-)

Original comment by alobbs on 28 Nov 2008 at 10:07

GoogleCodeExporter commented 9 years ago
Thanks Alvaro! ;)

Fixed in r2504

Original comment by skar...@gmail.com on 28 Nov 2008 at 12:56

GoogleCodeExporter commented 9 years ago

Original comment by skar...@gmail.com on 28 Nov 2008 at 12:57

GoogleCodeExporter commented 9 years ago
Thank you all for looking into this issue! I will grab the latest changeset, 
compile
it and test if my issue is fixed. I will set the status to verified once the fix
turns out positive!

Original comment by milovand...@gmail.com on 28 Nov 2008 at 2:18

GoogleCodeExporter commented 9 years ago
Tests turned out good.

The internal url /wms(.*)

with the rule /wms(.*)\?(.*) 
/cgi-bin/mapserv?map=/path/to/maps/$1.map&Version=1.1.0&$2

routes correct!

Original comment by milovand...@gmail.com on 28 Nov 2008 at 5:17

GoogleCodeExporter commented 9 years ago
A new QA test covering this case should be added as well.

Original comment by alobbs on 28 Nov 2008 at 5:57

GoogleCodeExporter commented 9 years ago
skarcha, I still have no clue why it is working now, and yesterday it was still 
broken.

Original comment by ste...@konink.de on 28 Nov 2008 at 8:19