[hunchentoot-devel] Why can't the python script get the post parameters from hunchentoot-cgi?

Hans Hübner hans.huebner at gmail.com
Mon Jan 9 08:21:36 UTC 2012


On Mon, Jan 9, 2012 at 8:21 AM, z_axis <z_axis at 163.com> wrote:
> I know this is a hunchentoot list.However, besides there is no
> hunchentoot-cgi mailing list, maybe this problem is relative to hunchentoot
> as hunchentoot-cgi call #'create-prefix-dispatcher in which hunchentoot
> doesnot prepare both content-type and content-length.

Again, please report this issue to the hunchentoot-cgi maintainers.
The hunchentoot API has changed and hunchentoot-cgi needs to be fixed
to cater for that, not the other way round.

-Hans

>
> 在 Mon, 09 Jan 2012 15:01:28 +0800,Hans Hübner <hans.huebner at gmail.com> 写道:
>
>
>> Hi,
>>
>> hunchentoot-cgi is a package separate from Hunchentoot.  The canonical
>> location of it is https://github.com/slyrus/hunchentoot-cgi, so you
>> can either report the problem as an issue or, better yet, fix it and
>> send a pull request there.
>>
>> -Hans
>>
>> On Mon, Jan 9, 2012 at 3:14 AM, z_axis <z_axis at 163.com> wrote:
>>>
>>> The hunchentoot-cgi basically works with hunchentoot-1.2.2 now with a few
>>> modification:
>>> 1. In #'handle-cgi-script, replacing :external-format tbnl::+latin-1+
>>> with
>>> :external-format tbnl::+utf-8+
>>> 2. As WhiteCat suggested, use #'make-pathname as below:
>>>
>>> (pushnew (hunchentoot-cgi::create-cgi-dispatcher-and-handler
>>>         "/cgi-bin/"
>>>         (make-pathname :directory '(:absolute "media" "E" "myapp"
>>> "cgi-bin")))
>>>        dispatch-table :test #'equal)
>>>
>>> However, I do not understand why the python script cannot get the POSTed
>>> parameter,
>>> i.e., when visiting http://127.0.0:8000/cgi-bin/login.py?cmd=view,
>>> login.py
>>> can get the parameter cmd's value sucessfully,
>>>  but when posted by the following form, login.py cannot get all the
>>> posted
>>> values (no matter hidden or not):
>>>
>>> <html><body>
>>>  <form method='POST' action='cgi-bin/login.py'>
>>>   <input type='text' name='userid'>
>>>   <input type='password' name='userpwd'>
>>>   <input type='submit' value='Login'>
>>>   <input type='hidden' name='cmd' value='view'>
>>>  </form>
>>> </body></html>
>>>
>>> I guess hunchentoot-cgi does not pass the posted parameter(s) to the
>>> python
>>> script according to the environment:
>>>
>>> GET http://127.0.0.1:8000/cgi-bin/nav.py?userid=xyz&cmd=view
>>> (SERVER_SOFTWARE=hunchentoot/1.2.2
>>>  SERVER_NAME=127.0.0.1 GATEWAY_INTERFACE=CGI/1.1
>>>  SERVER_PROTOCOL=HTTP/1.1 SERVER_PORT=8000 REQUEST_METHOD=GET
>>>  CONTENT_TYPE=text/html CONTENT_LENGTH=NIL
>>>  SCRIPT_NAME=/cgi-bin/nav.py QUERY_STRING=userid=xyz&cmd=view
>>>  REMOTE_ADDR=127.0.0.1 HTTP_HOST=NIL
>>>  REQUEST_URI=/cgi-bin/nav.py?userid=xyz&cmd=view SERVER_ADDR=NIL
>>>  HTTP_USER_AGENT=Mozilla/5.0 (X11; Linux i686; rv:9.0.1) Gecko/20100101
>>> Firefox/9.0.1
>>>  HTTP_REFERER=http://127.0.0.1:8000/)
>>>
>>>
>>> POST to /cgi-bin/nav.py
>>> (SERVER_SOFTWARE=hunchentoot/1.2.2
>>>  SERVER_NAME=127.0.0.1 GATEWAY_INTERFACE=CGI/1.1
>>>  SERVER_PROTOCOL=HTTP/1.1 SERVER_PORT=8000 REQUEST_METHOD=POST
>>>  CONTENT_TYPE=text/html CONTENT_LENGTH=NIL
>>>  POST_PARAMETERS=((userid . xyz) (userpwd . 123) (cmd . view))
>>>  SCRIPT_NAME=/cgi-bin/nav.py QUERY_STRING=NIL REMOTE_ADDR=127.0.0.1
>>>  HTTP_HOST=NIL REQUEST_URI=/cgi-bin/nav.py SERVER_ADDR=NIL
>>>  HTTP_USER_AGENT=Mozilla/5.0 (X11; Linux i686; rv:9.0.1) Gecko/20100101
>>> Firefox/9.0.1
>>>
>>> Please shed a light on me, thanks!
>>>
>>>
>>> _______________________________________________
>>> tbnl-devel site list
>>> tbnl-devel at common-lisp.net
>>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>>
>>
>> _______________________________________________
>> tbnl-devel site list
>> tbnl-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
>
>
> --
> 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
>
>
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel




More information about the Tbnl-devel mailing list