* Roberto De Ioris <[email protected]> [2013-04-03 16:16]:
>
>> * Roberto De Ioris 
>> <[email protected]> [2013-04-03
>> 13:20]:
>>> I have just committed the cgi and cgihelper routing actions.
>>
>> Thanks a lot!
>>
>>> I am not sure of the implications about SCRIPT_NAME and PATH_INFO
>>>
>>> Let me know if there is something wrong
>>
>> It would be nice to return a 404 in case a script does not exist,
>> currently it logs
>>
>> uwsgi_cgi_run()/execvp(): No such file or directory
>> [plugins/cgi/cgi_plugin.c line 868]
>> invalid CGI output !!!
>>
>> and closes the connection. That allows e.g. something like
>> route-uri = ^/virtual/(.*)$ cgi:/home/gber/cgi-bin/$1
>
>
> Fixed.
>
>>
>> The handling of PATH_INFO and SCRIPT_NAME does not seem to have
>> changed, however even in older revisions it does not seem to be
>> correct at least as I understand it since SCRIPT_NAME is always
>> empty and PATH_INFO always contains the full path.
>> In case of a request of
>> http://127.0.0.1:8000/cgi-bin/index.cgi shouldn't it be like
>> SCRIPT_NAME=/virtual/test.cgi
>> PATH_INFO=
>> rather than
>> SCRIPT_NAME=
>> PATH_INFO=/virtual/test.cgi
>> and in case of http://127.0.0.1:8000/cgi-bin/index.cgi/foo/bar
>> SCRIPT_NAME=/virtual/test.cgi
>> PATH_INFO=/foo/bar
>> rather than
>> SCRIPT_NAME=
>> PATH_INFO=/virtual/test.cgi/foo/bar
>> ?
>
>
> Are you sure about this, i have tested all of the combinations and
> SCRIPT_NAME and PATH_INFO works exacly in this way:
>
> ./uwsgi --http-socket :9090 --http-socket-modifier1 9 --cgi
> /foo=/root/uwsgi/index2.pl
>
> a request for /foo/bar will result in
>
> SCRIPT_NAME=/foo
> PATH_INFO=/bar
>
> as well as
>
> ./uwsgi --http-socket :9090 --http-socket-modifier1 9 --cgi /foo=/root/uwsgi
>
> a request for /index.pl/foo/bar will result in
>
> SCRIPT_NAME=/index.pl
> PATH_INFO=/foo/bar
>
>
> The problem with routing is that we only have SCRIPT_NAME and PATH_INFO
> passed from the webserver... Maybe we should simply ignore them and let
> the user defining them via the routing system

After some more testing it turns out that it is only wrong in the
debug output:

./uwsgi --plugins=0:cgi --http-socket=:8000 --cgi=/virtual=/home/gber/cgi-bin

GET http://127.0.0.1:8000/virtual/index.cgi

[...]
[uWSGI DEBUG] PATH_INFO=/virtual/index.cgi
[uWSGI DEBUG] SCRIPT_NAME=

whereas in the script env:
PATH_INFO is not set (which is correct)
SCRIPT_NAME=/virtual/index.cgi

GET http://127.0.0.1:8000/virtual/index.cgi/foo/bar

[...]
[uWSGI DEBUG] PATH_INFO=/virtual/index.cgi/foo/bar
[uWSGI DEBUG] SCRIPT_NAME=

script env:
PATH_INFO=/foo/bar
SCRIPT_NAME=/virtual/index.cgi

So it is only a bug in the debug output which is probably why
I've not run into problems before.
-- 
Guido Berhoerster
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to