char *data = "">
evbuffer_copyout(in_evb, data, len);
evhttp_parse_query_str(data, evhttp_request_get_input_headers(req));
time_t now;
time(&now);
evbuffer_add_printf(evb, "<html>\n <head>\n"
" <title>%s</title>\n"
" </head>\n"
" <body>\n"
" <h1>%s</h1>\n"
" <p>Current time is: %s</p>"
" <p>received data size: %d</p>\n"
" <p>received data: %s</p></body></html>",
"C servlet title",
"C servlet",
ctime(&now),
(int)len,
data);
evhttp_add_header(evhttp_request_get_output_headers(req),
"Content-Type", "text/html");
evhttp_send_reply(req, 200, "OK", evb);
free(data);
}
in data I have this string "param1=value1¶m2=value2". I would like to use the in-build parser and I added:
evhttp_parse_query_str(data, evhttp_request_get_input_headers(req));
but I am not sure how I can access the parsed key/values and if I am using the right function. I can see from the source the the function doing the parsing is evhttp_parse_query_impl(const char *str, struct evkeyvalq *headers,int is_whole_uri) in http.c but this line:
evhttp_add_header_internal(headers, key, decoded_value);
tells me that the decoded value in stored in evhttp_add_header_internal. I am a bit confused... sorry to post so simple questions :-(
--
Riccardo Tacconi
Ruby on Rails and PHP development - System Administration
VIRTUELOGIC LIMITED
http://github.com/rtacconihttp://riccardotacconi.blogspot.com
http://twitter.com/rtacconi