]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
support for questionmark in URL behind the initial one
authordenis <>
Wed, 24 Jan 2007 21:12:05 +0000 (21:12 +0000)
committerdenis <>
Wed, 24 Jan 2007 21:12:05 +0000 (21:12 +0000)
scan_urlencoded_query.c

index b255811f354703547975410dfd65c4445594c9cd..fdcc3e6dc6fb4704a2ddd41002eadeb595ce45b7 100644 (file)
@@ -21,6 +21,7 @@ size_t scan_urlencoded_query(char **string, char *deststring, int flags) {
   unsigned char *d = (unsigned char*)deststring;
   register unsigned char b, c;
 
+retry_parsing:
   while( is_unreserved( c = *s++) ) {
     if( c=='%') {
       if( ( c = scan_fromhex(*s++) ) == 0xff ) return -1;
@@ -36,7 +37,9 @@ size_t scan_urlencoded_query(char **string, char *deststring, int flags) {
     --s;
     break;
   case '?':
-    if( flags != SCAN_PATH ) return -1;
+    if( flags == SCAN_PATH ) goto found_terminator;
+    *d++ = c;
+    goto retry_parsing;
     break;
   case '=':
     if( flags != SCAN_SEARCHPATH_PARAM ) return -1;
@@ -49,6 +52,7 @@ size_t scan_urlencoded_query(char **string, char *deststring, int flags) {
     return -1;
   }
 
+found_terminator:
   *string = (char *)s;
   return d - (unsigned char*)deststring;
 }