Created
January 31, 2014 07:30
-
-
Save kazeburo/8727914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/XS.xs b/XS.xs | |
index 4bf4c2a..cbe32bd 100644 | |
--- a/XS.xs | |
+++ b/XS.xs | |
@@ -121,13 +121,14 @@ struct _ust { | |
static void | |
url_params_each(pTHX_ const char *s, const STRLEN len, const ust_t *u) { | |
+ static const char sep[] = "&;"; | |
const char *send = s + len; | |
const char *k, *kend, *v, *vend; | |
SV *tmpsv = NULL; | |
bool is_utf8 = FALSE; | |
while (s < send) { | |
- if ((vend = (const char *)memchr(s, '&', send - s)) == NULL) | |
+ if ((vend = (const char *)strpbrk(s, sep)) == NULL) | |
vend = send; | |
if ((kend = (const char *)memchr(s, '=', vend - s)) == NULL) { | |
s = vend + (vend != send); | |
@@ -135,6 +136,9 @@ url_params_each(pTHX_ const char *s, const STRLEN len, const ust_t *u) { | |
} | |
k = s; | |
+ if ( k[0] == ' ' ) { | |
+ k++; | |
+ } | |
v = kend + 1; | |
if (u->decode == &url_decode_utf8 || url_encoded(k, kend - k)) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment