mirror of
https://github.com/lxsang/ant-http
synced 2024-11-20 02:08:21 +01:00
fix crash when decode query
This commit is contained in:
parent
101cbead6c
commit
08e3e118c4
@ -487,9 +487,11 @@ dictionary decode_request(int client,const char* method, char* url)
|
|||||||
|
|
||||||
if(strcmp(method,"GET") == 0)
|
if(strcmp(method,"GET") == 0)
|
||||||
{
|
{
|
||||||
|
if(query)
|
||||||
request = decode_url_request(query);
|
{
|
||||||
if(query) free(query);
|
request = decode_url_request(query);
|
||||||
|
free(query);
|
||||||
|
}
|
||||||
if(ws && ws_key != NULL)
|
if(ws && ws_key != NULL)
|
||||||
{
|
{
|
||||||
ws_confirm_request(client, ws_key);
|
ws_confirm_request(client, ws_key);
|
||||||
@ -753,10 +755,10 @@ dictionary decode_multi_part_request(int client,const char* ctype)
|
|||||||
*/
|
*/
|
||||||
dictionary decode_url_request(const char* query)
|
dictionary decode_url_request(const char* query)
|
||||||
{
|
{
|
||||||
|
if(query == NULL) return NULL;
|
||||||
char* str_copy = strdup(query);
|
char* str_copy = strdup(query);
|
||||||
//str_copy = ;
|
//str_copy = ;
|
||||||
char* token;
|
char* token;
|
||||||
if(query == NULL) return NULL;
|
|
||||||
if(strlen(query) == 0) return NULL;
|
if(strlen(query) == 0) return NULL;
|
||||||
dictionary dic = dict();
|
dictionary dic = dict();
|
||||||
while ((token = strsep(&str_copy, "&")))
|
while ((token = strsep(&str_copy, "&")))
|
||||||
|
Loading…
Reference in New Issue
Block a user