[Seaside] POST fields vs GET fields
Miguel Enrique Cobá Martinez
miguel.coba at gmail.com
Wed Mar 17 22:28:41 UTC 2010
El mié, 17-03-2010 a las 22:02 +0000, Julian Fitzell escribió:
> That's definitely not the way things *should* be working. There has
> been confusion about this (not just in seaside) because the fields
> that are part of the "query string" (as defined in the URI spec) are
> often (including in our code there) referred to as GET fields. With
> that name it sounds like they should not be valid for POST requests.
> The API for this has totally changed in Seaside 3.0, so you can now
> ask for the queryFields, the postFields, or a merged set of fields.
> The merging algorithm is, of course, kind of arbitrary so, depending
> on what you're doing, you might be better accessing the specific ones
> your looking for.
> As for 2.8, I guess we'd probably take a patch, though I don't know if
> there is any plan to do another bugfix release any time soon. Note
> that you have to deal with the case where some of the values in either
> of the fields dictionaries might actually be collections ( e.g.
> ?foo=1&foo=2 ).
Hi, yes that could be a problem maybe because the Dictionary used for
storing query string values (getFields) doesn't accept duplicates, but
the HttpFormDictionary can accept multiple values (as a form can have
multiple values, for example for checkboxes)
I have monkey patched my image and if a patch is needed the correct code
^aKomRequest postFields union: aKomRequest getFields
although this merges all and it would be better to have methods to get
the get and post fields in a separated way.
> 2010/3/17 Miguel Enrique Cobá Martinez <miguel.coba at gmail.com>:
> > I have a external application form that puts fields int the action url
> > in the form, additional to the body of the form fields:
> > <html>
> > <form
> > method="post"
> > action="https://azteca/?_s=seq7xo8ljGiFm8qq&_k=PadTSXes&1">
> > <input type="submit" name="aField" value="aValue">
> > <input type="hidden" name="otherField" value="otherValue">
> > </form>
> > </html>
> > The action url is the url in my seaside app that the external app must
> > return, adding some more values in the process, after redirecting to it.
> > But when returning to my app, I only get the form body fields, i.e.
> > aField, otherField, and the url fields (_s and _k) are lost, causing the
> > app to create a new session because of the lacking of the _s parameter.
> > I found that this is the point where the fields are lost:
> > WAKom>>fieldsOf: aKomRequest
> > ^aKomRequest method = 'POST'
> > ifTrue: [ aKomRequest postFields ]
> > ifFalse: [ aKomRequest getFields ]
> > Depending on the method of the form it only takes the corresponding
> > fields. But I think the correct form is to seaside to include ALL the
> > fields, in the url and in the form body in the fields available to the
> > app, independently of the method used to post the form (and in fact
> > Firefox, sends the values, an aKomRequest, that is processed by
> > Komanche, also gets them correctly).
> > Is that correct?
> > Shouldn't the fieldsOf method be:
> > WAKom>>fieldsOf: aKomRequest
> > ^ aKomRequest postFields addAll: aKomRequest getFields
> > Or is this forbidden by some RFC standard
> > Cheers
> > --
> > Miguel Cobá
> > http://miguel.leugim.com.mx
> > _______________________________________________
> > seaside mailing list
> > seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> seaside mailing list
> seaside at lists.squeakfoundation.org
More information about the seaside