Fix bug: uh_get_var()

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2017-12-09 17:00:25 +08:00
parent 90f38a6694
commit 1873edb5ed
1 changed files with 3 additions and 0 deletions

View File

@ -661,11 +661,14 @@ struct uh_str uh_get_var(struct uh_connection *con, const char *name)
struct uh_str *body = &con->req.body;
const char *pos, *tail, *p, *q;
struct uh_str var = {.at = NULL, .len = 0};
struct uh_str *content_type = uh_get_header(con, "Content-Type");
if (query->len > 0) {
pos = query->at;
tail = query->at + query->len - 1;
} else if (body->len > 0) {
if (!content_type || !uh_str_cmp(content_type, "application/x-www-form-urlencoded"))
return var;
pos = body->at;
tail = body->at + body->len - 1;
} else {