Post Data

26 views
Skip to first unread message

Edd S

unread,
Dec 27, 2009, 12:07:03 PM12/27/09
to nodejs
With the change in the URI parser it would seem that the query
parameters of a url are no longer parsed separately. I was previously
using the http.parseUri method to also handle parsing POST query
strings.

It would seem that in http.js there is a method still to do this
`_parseQueryString`. Would it be possible to have this moved somewhere
that is accessible as an API so that it can be used to handle POST
data also? or is it worth me extracting this method and including it
myself in projects?

If I am missing the 'proper' way to parse post data, or a reason why
using the same query string parser is a bad idea please let me know.

Edd

Felix Geisendörfer

unread,
Dec 27, 2009, 12:57:01 PM12/27/09
to nodejs
A proper parser should work asynchronous and handle nested parameters
like PHP (?a[b]=c). I would volunteer to implement it - Ryan, would
you accept a patch for this as a new module?

--fg

Connor Dunn

unread,
Dec 27, 2009, 1:05:26 PM12/27/09
to nod...@googlegroups.com
The majority of the work for this seems to have been done already
http://github.com/jazzychad/querystring.node.js

2009/12/27 Felix Geisendörfer <fe...@debuggable.com>:

> --
>
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>
>
>

Felix Geisendörfer

unread,
Dec 27, 2009, 4:12:07 PM12/27/09
to nodejs
> The majority of the work for this seems to have been done alreadyhttp://github.com/jazzychad/querystring.node.js

Thanks for pointing this out. Should be simple to build async support
into this.

-- Felix

On Dec 27, 7:05 pm, Connor Dunn <conno...@gmail.com> wrote:
> The majority of the work for this seems to have been done alreadyhttp://github.com/jazzychad/querystring.node.js

Daniel N

unread,
Dec 27, 2009, 6:08:39 PM12/27/09
to nod...@googlegroups.com
Hi Felix,

Just curious as to why you'd want async behavior on parsing a query string?  This is 100% in the  CPU with no IO so I'm wondering what the benefit of asyn behavior is.

Cheers
Daniel

2009/12/28 Felix Geisendörfer <fe...@debuggable.com>

Connor Dunn

unread,
Dec 27, 2009, 6:19:08 PM12/27/09
to nod...@googlegroups.com
Only reason I can this is the query string could be received in
multiple chunks, so you may wish to parse it as it arrives and get
callbacks for partial parsing?

2009/12/27 Daniel N <has...@gmail.com>:

Felix Geisendörfer

unread,
Dec 28, 2009, 4:12:38 AM12/28/09
to nodejs
> Only reason I can this is the query string could be received in
> multiple chunks, so you may wish to parse it as it arrives and get
> callbacks for partial parsing?

Yip, I'm thinking about parsing form data as it comes in from a HTTP
request. Just like the multipart module does it currently.

There would still be a sync / 1-line call if you already have all the
data, but in addition to that you could go the more fine-grained
callback route.

--fg


On Dec 28, 12:19 am, Connor Dunn <conno...@gmail.com> wrote:
> Only reason I can this is the query string could be received in
> multiple chunks, so you may wish to parse it as it arrives and get
> callbacks for partial parsing?
>

> 2009/12/27 Daniel N <has....@gmail.com>:

Reply all
Reply to author
Forward
0 new messages