Make cookie header parser more lenient
parent
a28bf0b918
commit
4f81b6750f
|
@ -11,12 +11,6 @@ IN: http.tests
|
|||
|
||||
[ "application/octet-stream" binary ] [ "application/octet-stream" parse-content-type ] unit-test
|
||||
|
||||
[ { } ] [ "" parse-cookie ] unit-test
|
||||
[ { } ] [ "" parse-set-cookie ] unit-test
|
||||
|
||||
! Make sure that totally invalid cookies don't confuse us
|
||||
[ { } ] [ "hello world; how are you" parse-cookie ] unit-test
|
||||
|
||||
: lf>crlf "\n" split "\r\n" join ;
|
||||
|
||||
STRING: read-request-test-1
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
IN: http.parsers.tests
|
||||
USING: http http.parsers tools.test ;
|
||||
|
||||
[ { } ] [ "" parse-cookie ] unit-test
|
||||
[ { } ] [ "" parse-set-cookie ] unit-test
|
||||
|
||||
! Make sure that totally invalid cookies don't confuse us
|
||||
[ { } ] [ "hello world; how are you" parse-cookie ] unit-test
|
||||
|
||||
[ { T{ cookie { name "__s" } { value "12345567" } } } ]
|
||||
[ "__s=12345567" parse-cookie ]
|
||||
unit-test
|
||||
|
||||
[ { T{ cookie { name "__s" } { value "12345567" } } } ]
|
||||
[ "__s=12345567;" parse-cookie ]
|
||||
unit-test
|
|
@ -162,7 +162,7 @@ PEG: (parse-set-cookie) ( string -- alist )
|
|||
'value' ,
|
||||
'space' ,
|
||||
] seq*
|
||||
[ ";,=" member? not ] satisfy repeat1 [ drop f ] action
|
||||
[ ";,=" member? not ] satisfy repeat0 [ drop f ] action
|
||||
2choice ;
|
||||
|
||||
PEG: (parse-cookie) ( string -- alist )
|
||||
|
|
Loading…
Reference in New Issue