Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

mg_get_http_var returns incorrect value

Hello,
I am trying to get the variable from http query using mg_get_http_var api, but its giving incorrect value.
Http Request : http:/localhost:15701/getfile?path=D:\streams\DD+.mpg
Here is pseudo code used.
struct mg_str buf = hm->query_string;
int len = mg_get_http_var(&buf, "path",dst,dst_len);
API gives dst value as "D:\streams\DD .mpg" instead of "D:\streams\DD+.mpg".
I tried to check mg_get_http_var API definition , mg_url_decode is called with is_form_url_encoded =1, so '+' is replaced with ' '.
Is this a correct behavior?
Should I set is_form_url_encoded value to 0 for mg_url_decode function called in mg_get_http_var API?

Regards,
Mor

Sign In or Register to comment.