summaryrefslogtreecommitdiff
path: root/scan_urlencoded_query.c
diff options
context:
space:
mode:
authordenis <>2007-01-24 21:12:05 +0000
committerdenis <>2007-01-24 21:12:05 +0000
commit99c1ba18963ddebf5b2d8b6d7424b762de7f5f75 (patch)
treefa538dec1b9df7d9ef0651c1ee9367209dec5ec9 /scan_urlencoded_query.c
parenta291ceda98035fbe3b8d666754e5b299675c60f9 (diff)
support for questionmark in URL behind the initial one
Diffstat (limited to 'scan_urlencoded_query.c')
-rw-r--r--scan_urlencoded_query.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c
index b255811..fdcc3e6 100644
--- a/scan_urlencoded_query.c
+++ b/scan_urlencoded_query.c
@@ -21,6 +21,7 @@ size_t scan_urlencoded_query(char **string, char *deststring, int flags) {
21 unsigned char *d = (unsigned char*)deststring; 21 unsigned char *d = (unsigned char*)deststring;
22 register unsigned char b, c; 22 register unsigned char b, c;
23 23
24retry_parsing:
24 while( is_unreserved( c = *s++) ) { 25 while( is_unreserved( c = *s++) ) {
25 if( c=='%') { 26 if( c=='%') {
26 if( ( c = scan_fromhex(*s++) ) == 0xff ) return -1; 27 if( ( c = scan_fromhex(*s++) ) == 0xff ) return -1;
@@ -36,7 +37,9 @@ size_t scan_urlencoded_query(char **string, char *deststring, int flags) {
36 --s; 37 --s;
37 break; 38 break;
38 case '?': 39 case '?':
39 if( flags != SCAN_PATH ) return -1; 40 if( flags == SCAN_PATH ) goto found_terminator;
41 *d++ = c;
42 goto retry_parsing;
40 break; 43 break;
41 case '=': 44 case '=':
42 if( flags != SCAN_SEARCHPATH_PARAM ) return -1; 45 if( flags != SCAN_SEARCHPATH_PARAM ) return -1;
@@ -49,6 +52,7 @@ size_t scan_urlencoded_query(char **string, char *deststring, int flags) {
49 return -1; 52 return -1;
50 } 53 }
51 54
55found_terminator:
52 *string = (char *)s; 56 *string = (char *)s;
53 return d - (unsigned char*)deststring; 57 return d - (unsigned char*)deststring;
54} 58}