diff --git a/src/main/parsing.cl b/src/main/parsing.cl index 3a05bf2..bf5d20d 100644 --- a/src/main/parsing.cl +++ b/src/main/parsing.cl @@ -371,16 +371,16 @@ (defun parse-rfc1123-date (string &optional (start 0) (end (length string))) (with-lws-trimmed-bounds (string start end) - (unless (= 29 (- end start)) + (unless (<= 29 (- end start)) (error 'clash-syntax-error :fragment (subseq string start end) :reason - "Invalid length for rfc1123-date (too short or too long)")) + "Invalid length for rfc1123-date (too short)")) (let ((day (parse-http-day string (+ start 5) (+ start 7))) (month (lookup-month-by-name string (+ start 8) (+ start 11))) (year (parse-http-year string (+ start 12) (+ start 16)))) (multiple-value-bind (hour min sec) (parse-http-time string (+ start 17) (+ start 25)) - (unless (string= string " GMT" :start1 (+ start 25) :end1 end) + (unless (string= string " GMT" :start1 (+ start 25) :end1 (+ start 29)) (error 'clash-syntax-error :fragment (subseq string start end) :reason "Invalid time-zone (must be GMT)")) @@ -397,7 +397,7 @@ (defun parse-rfc850-date (string &optional (start 0) (end (length string))) (with-lws-trimmed-bounds (string start end) (let ((day-end (position #\, string :start start :end end))) - (unless (and day-end (= 24 (- end day-end)) + (unless (and day-end (<= 24 (- end day-end)) (<= 6 (- day-end start) 9)) (error 'clash-syntax-error :fragment (subseq string start end) :reason @@ -407,7 +407,8 @@ (year (parse-http-year string (+ day-end 9) (+ day-end 11)))) (multiple-value-bind (hour min sec) (parse-http-time string (+ day-end 12) (+ day-end 20)) - (unless (string= string " GMT" :start1 (+ day-end 20) :end1 end) + (unless (string= string " GMT" :start1 (+ day-end 20) + :end1 (+ day-end 24)) (error 'clash-syntax-error :fragment (subseq string start end) :reason "Invalid time-zone (must be GMT)")) @@ -423,10 +424,10 @@ (defun parse-asctime-date (string &optional (start 0) (end (length string))) (with-lws-trimmed-bounds (string start end) - (unless (= 24 (- end start)) + (unless (<= 24 (- end start)) (error 'clash-syntax-error :fragment (subseq string start end) :reason - "Invalid length for asctime-date (too short or too long)")) + "Invalid length for asctime-date (too short)")) (let ((day (parse-http-day string (+ start 8) (+ start 10))) (month (lookup-month-by-name string (+ start 4) (+ start 7))) (year (parse-http-year string (+ start 20) (+ start 24))))