diff --git a/CREDITS b/CREDITS index 4386e2e3..07146604 100644 --- a/CREDITS +++ b/CREDITS @@ -43,3 +43,6 @@ Paul Kim (mrpickles@users.sourceforge.net) * Various AAC meta-info cleanups * Compilation tag support (aac and mp3) +Stephen Lee (slee@nis.net) + * Patches for proper url decoding + diff --git a/src/configfile.c b/src/configfile.c index fde7d528..5386f6af 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -887,9 +887,11 @@ void config_set_status(WS_CONNINFO *pwsc, int session, char *fmt, ...) { va_list ap; SCAN_STATUS *pfirst, *plast; + DPRINTF(ERR_DEBUG,"Entering config_set_status\n"); + if(config_mutex_lock()) { /* we should really shutdown the app here... */ - exit(EXIT_FAILURE); + DPRINTF(ERR_FATAL,"Error acquiring config mutex\n"); } pfirst=plast=scan_status.next; @@ -921,6 +923,7 @@ void config_set_status(WS_CONNINFO *pwsc, int session, char *fmt, ...) { } else { if(!pfirst) { config_mutex_unlock(); + DPRINTF(ERR_DEBUG,"Exiting config_set_status\n"); return; } @@ -938,6 +941,7 @@ void config_set_status(WS_CONNINFO *pwsc, int session, char *fmt, ...) { } config_mutex_unlock(); + DPRINTF(ERR_DEBUG,"Exiting config_set_status\n"); } /* diff --git a/src/webserver.c b/src/webserver.c index 41436d1c..01e18869 100644 --- a/src/webserver.c +++ b/src/webserver.c @@ -616,19 +616,18 @@ int ws_getheaders(WS_CONNINFO *pwsc) { int ws_getgetvars(WS_CONNINFO *pwsc, char *string) { char *new_string; char *first, *last, *middle; + char *key, *value; int done; DPRINTF(ERR_DEBUG,"Thread %d: Original string: %s\n", pwsc->threadno,string); - new_string=ws_urldecode(string); - DPRINTF(ERR_DEBUG,"Thread %d: Processing GET/POSTs from %s\n", pwsc->threadno,string); done=0; - first=new_string; + first=string; while((!done) && (first)) { last=middle=first; @@ -639,9 +638,15 @@ int ws_getgetvars(WS_CONNINFO *pwsc, char *string) { DPRINTF(ERR_WARN,"Thread %d: Bad arg: %s\n", pwsc->threadno,first); } else { + key=ws_urldecode(first); + value=ws_urldecode(middle); + DPRINTF(ERR_DEBUG,"Thread %d: Adding arg %s = %s\n", - pwsc->threadno,first,middle); - ws_addarg(&pwsc->request_vars,first,"%s",middle); + pwsc->threadno,key,value); + ws_addarg(&pwsc->request_vars,key,"%s",value); + + free(key); + free(value); } if(!last) { @@ -653,7 +658,6 @@ int ws_getgetvars(WS_CONNINFO *pwsc, char *string) { } } - free(new_string); return 0; }