[Seaside] POST fields vs GET fields
Miguel Enrique Cobá Martinez
miguel.coba at gmail.com
Wed Mar 17 22:19:27 UTC 2010
El mié, 17-03-2010 a las 11:08 -0700, Randal L. Schwartz escribió:
> >>>>> "Miguel" == Miguel Enrique Cobá Martinez <miguel.coba at gmail.com> writes:
> Miguel> I found that this is the point where the fields are lost:
> WAKom> fieldsOf: aKomRequest
> Miguel> ^aKomRequest method = 'POST'
> Miguel> ifTrue: [ aKomRequest postFields ]
> Miguel> ifFalse: [ aKomRequest getFields ]
> Miguel> Or is this forbidden by some RFC standard
> The most common CGI parser in the world, CGI.pm, has this to say:
> It is possible for a script to receive CGI parameters in the URL as well
> as in the fill-out form by creating a form that POSTs to a URL containing
> a query string (a "?" mark followed by arguments). The param() method will
> always return the contents of the POSTed fill-out form, ignoring the URL's
> query string. To retrieve URL parameters, call the url_param() method. Use
> it in the same way as param(). The main difference is that it allows you
> to read the parameters, but not set them.
> Under no circumstances will the contents of the URL query string interfere
> with similarly-named CGI parameters in POSTed forms. If you try to mix a
> URL query string with a form submitted with the GET method, the results
> will not be what you expect.
> I trust Lincoln Stein to be following some official guideline on this, but he
> doesn't quote it, unfortunately.
Yes, it is confusing, but allowed if you want to mix post and get
fields. My point is, there are times when you need to uses the fields,
no matter where they are coming from, query string or form data.
Maybe in a RESTful app there is consequences, but at least in my app, I
am giving the external app an url to return to my app. And the external
app uses that url and adds some parameters to the post data.
In fact, as a consequence of this the forms in seaside put the _s and _k
parameters as hidden fields inside the form and not in the action url.
So, I am monkeypatching the seaside code in my image and use it, as I
have very well defined variables to handle and I expect no problems by
merging postFields with getFields.
Thanks for the information anyway.
BTW, the code should be:
^aKomRequest postFields union: aKomRequest getFields
More information about the seaside