Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1 Yaws 0.52 form processing is incorrect

closed-fixed
nobody
None
5
2003-06-02
2002-07-02
Anonymous
No

The yaws_api:parse_post_data seems to have been
altered to automatically detect POST/GET methods and
still get the correct information.

This is really bad, and it has bugs in it too. :-(

Concept:
It is quite possible for a form to do a POST and have
query data associated with it (for example, update a
record, and in another <erl> section the query is done).

My userEdit.yaws does this successfully - it means the
same form can be used for the initial query (a get on
userEdit.yaws?userid=1234) and for update (a post on
userEdit.yaws?userid=1234, which then invokes the
query section after the update).

This worked in yaws 0.48.

Problem:
The yaws_api:parse_post_data has been updated to the
following:

parse_post_data(Arg) ->
Headers = Arg#arg.headers,
case lists:keysearch('Content-Type', 3,
Headers#headers.other) of
{value, {_,_,_,_,"multipart/form-data"++Line}} ->
LineArgs = parse_arg_line(Line),
{value, {_, Boundary}} = lists:keysearch
(boundary, 1, LineArgs),
parse_multipart(Boundary, binary_to_list
(Arg#arg.clidata));
_ ->
parse_post_data_urlencoded(Arg#arg.querydata)
end.

However in a non-multipart form it incorrectly goes for
the querydata instead of the clidata. Quite probably it
should always do the clidata (which is what it says -
parse_post_data). If it is really desired to overload this
function to do both then it should check the http_request
to see if this is a POST.

Discussion

  • Logged In: YES
    user_id=1831

    oops, this is my bug. Wasn't logged in.

     
  • Claes Wikstrom
    Claes Wikstrom
    2003-06-02

    • status: open --> closed
     
  • Claes Wikstrom
    Claes Wikstrom
    2003-06-02

    • status: closed --> closed-fixed