[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] bug + question
- To: libevent-users@xxxxxxxxxxxxx
- Subject: [Libevent-users] bug + question
- From: Mihai Draghicioiu <mihai.draghicioiu@xxxxxxxxx>
- Date: Fri, 31 Dec 2010 03:21:29 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Thu, 30 Dec 2010 20:21:34 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=4ZR9n/ZcAsAHzaTTCuv8Z6Lk0SOIPzfNWQN+J6cvYJQ=; b=w8VR+LHgdWUaC8Pm/y2cx2FvkBs5WbArqU21Ze1jQqwaVx4m96CzSecHc8YPQO+Dkw X6tY5igGEmndVEbNP4U91yASQPzbwrQqkK/r/3i8FOWcpFcF6CTuHVn1VM552m4Div7N 82uXYVDYRoDLW+b4Mvf9+qB0lkIp7/94I5r94=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=hNlKVTJ8dIalFWH+dr1MEIwfkmadkXEA6MCxxyzAo90lzQCWx/2IaP1Rj0AUhOcs+0 ac8Dw4CGEFa2popA/O8fzSOUB6CiRkTtEFAY6ZT+2Q4CgVA8DvsTp+qvz9tpso6zy54P DxnorPap+l9fwxZ/nkSJ4/ohEz7BDGuqF/LS4=
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
Hi all. I've found that evhttp_parse_query_str only works if the query
string is of the form foo=bar&baz=quux. If we have a query string of
the form foo=bar&baz (no value for the last key), it fails. I consider
this a bug, because you have all the other valid parameters in there,
and it can just set NULL for the value of the baz parameter. I believe
the behavior of evhttp_parse_query() is different (correct). I had
used evhttp_parse_query() until now, and switched to
evhttp_parse_query_str() and discovered this bug.
Second, I have a question - does one need to evhttp_uri_free() the
returned pointer from evhttp_request_get_evhttp_uri()? It crashes if I
do free it, so i'd like to make sure it's correct to not free it (no
memory leaks).
Also, is the evkeyvalq usage in this example correct? Note that it
includes the issues described above:
static void httpcb(struct evhttp_request *req, void *arg) {
evkeyvalq query; // is it meant to be used in this way?
evhttp_parse_query_str(evhttp_uri_get_query(evhttp_request_get_evhttp_uri(req)),
&query);
const char *val;
if((val = evhttp_find_header(&query, "command"))) {
...
}
}
Thanks
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.