rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Parsing non-nested requests
@ 2009-06-16  4:43 Simon Chiang
  0 siblings, 0 replies; only message in thread
From: Simon Chiang @ 2009-06-16  4:43 UTC (permalink / raw)
  To: Rack Development


I have run into situations where I'd like to parse requests in an non-
nested fashion.  Rack::Request almost lets you do this, but not
quite.  I propose the changes in this commit:

  http://github.com/bahuvrihi/rack/commit/fa29dc523a0994a85686b01a192d3ccbfb36c183

The commit refactors Rack::Request so that the parsing methods for
query strings and multipart data may be overridden.  Then for non-
multipart data I think everything is fine; you would simply subclass
Request and call Utils.parse_query instead of
Utils.parse_nested_query.

Multipart data requires a little patch though because as far as I can
tell Multipart.parse_multipart parses nested queries and you can't get
around that.  I also propose the changes in this commit:

  http://github.com/bahuvrihi/rack/commit/d6a2a162651c8068822a9370fe66eeb709a5d69c

The commit adds a flag to parse_multipart to allow non-nested
parsing.  The flag is a little inelegant, but at least it's backwards
compatible.  A more elegant solution would be to have parse_multipart
and parse_nested_multipart, but that would be bad for anyone that
expects the current behavior.

Any thoughts?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-16  4:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16  4:43 Parsing non-nested requests Simon Chiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).