Fix URL handling for parameters with either an ampersand (&) or and equal (=). Patches from Stephen Lee fixing a bug reported by Peter Gutbrod.

This commit is contained in:
Ron Pedde 2004-11-06 04:44:20 +00:00
parent 35d5710d65
commit 7f046ed3b1
3 changed files with 18 additions and 7 deletions

View File

@ -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

View File

@ -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");
}
/*

View File

@ -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;
}