Skip to content

Commit

Permalink
Fix bug where we unreasonably reject konqueror's accept-encoding headers
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorycollins committed May 22, 2010
1 parent e1ea730 commit cc86118
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Snap/Util/GZip.hs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ acceptParser = do
float
return ()

coding = string "*" <|> takeWhile isAlpha_ascii
coding = string "*" <|> takeWhile isCodingChar

isCodingChar c = isAlpha_ascii c || c == '-'

float = takeWhile isDigit >>
option () (char '.' >> takeWhile isDigit >> pure ())
Expand Down
2 changes: 1 addition & 1 deletion test/suite/Snap/Util/GZip/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ liftQ = QC.run
------------------------------------------------------------------------------
gzipHdrs, badHdrs, compressHdrs, emptyHdrs :: Headers
emptyHdrs = Map.empty
gzipHdrs = setHeader "Accept-Encoding" "froz,gzip" emptyHdrs
gzipHdrs = setHeader "Accept-Encoding" "froz,gzip, x-gzip" emptyHdrs
badHdrs = setHeader "Accept-Encoding" "*&%^&^$%&%&*^\023" emptyHdrs
compressHdrs = setHeader "Accept-Encoding" "compress" emptyHdrs

Expand Down

0 comments on commit cc86118

Please sign in to comment.