From cdd4c0fa35d58f6e353592cdaa74549c37e36834 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Wed, 5 Sep 2018 19:08:26 +0200 Subject: [PATCH] fix missing query in POST request --- http_server.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/http_server.c b/http_server.c index 01398b5..2257987 100644 --- a/http_server.c +++ b/http_server.c @@ -576,8 +576,6 @@ dictionary decode_request(void* client,const char* method, char* url) } else { - if(query) - free(query); if(ws_key) free(ws_key); if(ctype == NULL || clen == -1) @@ -600,17 +598,21 @@ dictionary decode_request(void* client,const char* method, char* url) } else { - char* query = post_data_decode(client,clen); + if(query) + request = decode_url_request(query); + char* pquery = post_data_decode(client,clen); char* key = strstr(ctype,"/"); if(key) key++; else key = ctype; - request = dict(); - dput(request,key, strdup(query)); - free(query); + if(!request) + request = dict(); + dput(request,key, strdup(pquery)); + free(pquery); } - + if(query) + free(query); } if(ctype) free(ctype); //if(cookie->key == NULL) {free(cookie);cookie= NULL;}