decode_packet for the body
Joel Reymont
joelr1@REDACTED
Thu May 28 16:38:17 CEST 2009
Suppose I repeatedly ran erlang:decode_packet until it returned
http_eoh (end of headers). I get something like this after
accumulating the results.
{[{http_header,42,'Content-Type',undefined,
<<"application/x-www-form-urlencoded">>},
{http_header,38,'Content-Length',undefined,<<"55">>},
{http_header,8,'Accept',undefined,<<"*/*">>},
{http_header,14,'Host',undefined,<<"localhost:8081">>},
{http_header,24,'User-Agent',undefined,
<<"curl/7.19.4 (i386-apple-darwin9.7.0) libcurl/
7.19.4 zlib/1.2.3">>},
{http_request,'POST',{abs_path,<<"/publish">>},{1,1}}],
%% body that I still need to decode!
<<"topic=events&event=test_event&data=%7b\"word\":\"hello\"%7d">>}
Notice that the body of the POST is x-www-form-urlencoded.
Is there a built-in function somewhere to split the body into fields
and values?
Thanks, Joel
---
Mac hacker with a performance bent
http://www.linkedin.com/in/joelreymont
More information about the erlang-questions
mailing list