File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ _M.Sec_WebSocket_Version_Server = comma_sep(version)
420420-- RFC 6797
421421local directive_name = _M .token / string.lower
422422local directive_value = _M .token + _M .quoted_string
423- local directive = Cg (directive_name * ((P " =" * directive_value ) + Cc (true )))
423+ local directive = Cg (directive_name * ((_M . OWS * P " =" * _M . OWS * directive_value ) + Cc (true )))
424424_M .Strict_Transport_Security = directive ^- 1 * (_M .OWS * P " ;" * _M .OWS * directive ^- 1 )^ 0
425425
426426-- RFC 7089
Original file line number Diff line number Diff line change @@ -201,4 +201,12 @@ describe("http patterns", function()
201201 assert .same ({" foo" , {filename = " example" }}, Content_Disposition :match " foo; filename=example" )
202202 assert .same ({" foo" , {filename = " example" }}, Content_Disposition :match " foo; filename*=UTF-8''example" )
203203 end )
204+ it (" Parses a Strict-Transport-Security header" , function ()
205+ local sts_patt = lpeg .Cf (lpeg .Ct (true ) * http .Strict_Transport_Security , rawset ) * EOF
206+ assert .same ({[" max-age" ] = " 0" }, sts_patt :match (" max-age=0" ))
207+ assert .same ({[" max-age" ] = " 0" }, sts_patt :match (" max-age = 0" ))
208+ assert .same ({[" max-age" ] = " 0" }, sts_patt :match (" Max-Age=0" ))
209+ assert .same ({[" max-age" ] = " 0" ; includesubdomains = true }, sts_patt :match (" max-age=0;includeSubdomains" ))
210+ assert .same ({[" max-age" ] = " 0" ; includesubdomains = true }, sts_patt :match (" max-age=0 ; includeSubdomains" ))
211+ end )
204212end )
You can’t perform that action at this time.
0 commit comments