Skip to content

Commit

Permalink
The whitespace between an authentication method and its metadata is n…
Browse files Browse the repository at this point in the history
…ot optional
  • Loading branch information
Xophmeister committed Sep 5, 2017
1 parent 24d0ea0 commit ca05c3b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions irobot/authentication/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# per RFC7235: https://tools.ietf.org/html/rfc7235#section-2.1
#
# AUTH_HANDLERS := AUTH_HANDLER *( OWS "," OWS AUTH_HANDLER )
# AUTH_HANDLER := TOKEN [ OWS ( TOKEN68 / PARAMS ) ]
# AUTH_HANDLER := TOKEN [ 1*SP ( TOKEN68 / PARAMS ) ]
# PARAMS := PARAM ( OWS "," OWS PARAM )*
# PARAM := TOKEN OWS "=" OWS ( TOKEN / QUOTED_STRING )
# TOKEN := 1*( ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" )
Expand All @@ -37,7 +37,8 @@
# QUOTE := %x22
# ALPHA := %x41-5A / %x61-7A
# DIGIT := %x30-39
# OWS := *( %x09 / %x20 )
# OWS := *SP
# SP := %x09 / %x20


class ParseError(Exception):
Expand Down Expand Up @@ -149,6 +150,7 @@ def _parser(s:str) -> _ParseT:
return _parser


_WS = _terminal(re.compile(r"[\t ]+"))
_OWS = _terminal(re.compile(r"[\t ]*"))
_DIGIT = _terminal(re.compile(r"[0-9]"))
_ALPHA = _terminal(re.compile(r"[a-zA-Z]"))
Expand Down Expand Up @@ -302,7 +304,7 @@ def _auth_handler(s:str) -> Tuple[AuthHandler, str]:

except ParseError:
# There's no list separator, so there must be a payload/parameters
_, remainder = _OWS(remainder)
_, remainder = _WS(remainder)

try:
params, remainder = _params(remainder)
Expand Down

0 comments on commit ca05c3b

Please sign in to comment.