Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tune

  • Loading branch information...
commit 8c133520eb1771ac2f3e5bd4218ea8e879d58dcc 1 parent c9e646b
@kazeburo authored
Showing with 5 additions and 23 deletions.
  1. +5 −23 lib/Cookie/Baker/XS.xs
View
28 lib/Cookie/Baker/XS.xs
@@ -103,8 +103,8 @@ crush_cookie(cookie)
Newx(key, key_size, char);
src = (char *)SvPV(cookie,src_len);
prev = src;
- for ( i=0; i<src_len; i++ ) {
- if ( src[i] == ';' || src[i] == ',') {
+ for ( i=0; i<=src_len; i++ ) {
+ if ( i == src_len || src[i] == ';' || src[i] == ',' ) {
while ( prev[0] == ' ' ) {
prev++;
prev_s++;
@@ -122,27 +122,9 @@ crush_cookie(cookie)
url_decode_val(aTHX_ prev, p - prev + 1, la ), 0);
}
}
- prev = &src[i+1];
- prev_s = i + 1;
- }
- }
-
- if ( i > prev_s ) {
- if ( prev[0] == ' ' ) {
- prev++;
- prev_s++;
- }
- la = i - prev_s;
- while ( prev[la-1] == ' ' ) {
- --la;
- }
- p = memchr(prev, '=', i - prev_s);
- if ( p != NULL ) {
- renewmem(aTHX_ &key, &key_size, (p - prev)*3+1);
- url_decode_key(prev, p - prev, key, &key_len);
- if ( !hv_exists(hv, key, key_len) ) {
- (void)hv_store(hv, key, key_len,
- url_decode_val(aTHX_ prev, p - prev + 1, la ), 0);
+ if ( i+1 < src_len ) {
+ prev = &src[i+1];
+ prev_s = i + 1;
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.