> POSTing to a script behind cgi-index/php-index via a uwsgi socket
> causes request variables to be corrupted. This appears to be a
> problem at the core since I can reproduce with both the cgi and php
> plugins.
>
> $ curl -s -v --data 'myaction=foo' --data 'foo=bar' --data 'quux=waldo'
> http://testserver.test/index.cgi
> * About to connect() to testserver.test port 80 (#0)
> *   Trying 10.0.3.100... connected
> * Connected to testserver.test (10.0.3.100) port 80 (#0)
>> POST /index.cgi HTTP/1.1
>> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7
>> NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
>> Host: testserver.test
>> Accept: */*
>> Content-Length: 31
>> Content-Type: application/x-www-form-urlencoded
>>
> < HTTP/1.1 200 OK
> < Server: nginx/1.0.15
> < Date: Tue, 12 Mar 2013 14:25:33 GMT
> < Content-Type: text/plain
> < Transfer-Encoding: chunked
> < Connection: keep-alive
> <
> Request:
> myaction=foo
> foo=bar
> quux=waldo
> * Connection #0 to host testserver.test left intact
> * Closing connection #0
> $ curl -s -v --data 'myaction=foo' --data 'foo=bar' --data 'quux=waldo'
> http://testserver.test/
> * About to connect() to testserver.test port 80 (#0)
> *   Trying 10.0.3.100... connected
> * Connected to testserver.test (10.0.3.100) port 80 (#0)
>> POST / HTTP/1.1
>> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7
>> NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
>> Host: testserver.test
>> Accept: */*
>> Content-Length: 31
>> Content-Type: application/x-www-form-urlencoded
>>
> < HTTP/1.1 200 OK
> < Server: nginx/1.0.15
> < Date: Tue, 12 Mar 2013 14:25:39 GMT
> < Content-Type: text/plain
> < Transfer-Encoding: chunked
> < Connection: keep-alive
> <
> Request:
> PATH_INFO
> /index.cgiux=waldo
> * Connection #0 to host testserver.test left intact
> * Closing connection #0
>
> ----
>
> Minimal config to reproduce:
>
> ----
>
> [uwsgi]
> plugins = 0:notfound,cgi,router_uwsgi
> docroot = /home/gber/public_html
> uwsgi-socket = /tmp/uwsgi-test.sock
> chmod-socket = 777
> vacuum = true
>
> check-static-docroot = true
>
> cgi-from-docroot = true
> for = .cgi .lua .pl .py .rb .sh .tcl
>   static-skip-ext = %(_)
>   cgi-index = index%(_)
>   static-index = index%(_)
>   cgi-allowed-ext = %(_)
>   route = \%(_)$ uwsgi:,9,0
> endfor =
>
> ----
>
> index.cgi:
>
> ----
>
> #!/usr/bin/tclsh
> package require ncgi
>
> ::ncgi::parse
> ::ncgi::header "text/plain"
> puts "Request:"
> foreach {n v} [::ncgi::nvlist] {
>     puts "$n=$v"
> }
>
> ----
>
> I straced uwsgi to make sure that it's not the webserver (nginx in this
> case)
> and the data read from the socket looks fine to me:
>
> read(5,
> "\0/\2\0\f\0QUERY_STRING\0\0\16\0REQUEST_METHOD\4\0POST\f\0CONTENT_TYPE!\0application/x-www-form-urlencoded\16\0CONTENT_LENGTH\2\00031\v\0REQUEST_URI\n\0/index.cgi\t\0PATH_INFO\n\0/index.cgi\r\0DOCUMENT_ROOT\26\0/home/gber/public_html\17\0SERVER_PROTOCOL\10\0HTTP/1.1\v\0REMOTE_ADDR\n\00010.0.3.100\v\0REMOTE_PORT\5\00035011\v\0SERVER_PORT\2\00080\v\0SERVER_NAME\17\0testserver.test\17\0HTTP_USER_AGENTf\0curl/7.19.7
> (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3
> libidn/1.18
> libssh2/1.4.2\t\0HTTP_HOST\17\0testserver.test\v\0HTTP_ACCEPT\3\0*/*\23\0HTTP_CONTENT_LENGTH\2\00031\21\0HTTP_CONTENT_TYPE!\0application/x-www-form-urlencodedmyaction=foo&foo=bar&quux=waldo",
> 4100) = 594
> [...]
> read(5,
> "\0\35\2\0\f\0QUERY_STRING\0\0\16\0REQUEST_METHOD\4\0POST\f\0CONTENT_TYPE!\0application/x-www-form-urlencoded\16\0CONTENT_LENGTH\2\00031\v\0REQUEST_URI\1\0/\t\0PATH_INFO\1\0/\r\0DOCUMENT_ROOT\26\0/home/gber/public_html\17\0SERVER_PROTOCOL\10\0HTTP/1.1\v\0REMOTE_ADDR\n\00010.0.3.100\v\0REMOTE_PORT\5\00035012\v\0SERVER_PORT\2\00080\v\0SERVER_NAME\17\0testserver.test\17\0HTTP_USER_AGENTf\0curl/7.19.7
> (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3
> libidn/1.18
> libssh2/1.4.2\t\0HTTP_HOST\17\0testserver.test\v\0HTTP_ACCEPT\3\0*/*\23\0HTTP_CONTENT_LENGTH\2\00031\21\0HTTP_CONTENT_TYPE!\0application/x-www-form-urlencodedmyaction=foo&foo=bar&quux=waldo",
> 4100) = 576
>
> --
> Guido Berhoerster
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>


The problem (and the fix) are described here:

https://github.com/unbit/uwsgi/blob/master/core/protocol.c#L966

P.S.
can you open bug reports on github ? in addition to better tracking, i
fear users could be annoied by such low-level discussions :)

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to