Permalink
Browse files

When failing SYN_STREAM due to wrong length, show correct length.

  • Loading branch information...
kolmodin committed Mar 3, 2012
1 parent 6b4b30d commit f0e016db46a7111b1372586eb17ea1d6fbfc24b3
Showing with 4 additions and 4 deletions.
  1. +4 −4 Network/SPDY/Frame.hs
View
@@ -139,10 +139,10 @@ getSynStream header = do
synStreamFrameAssociatedStreamID <- getWord32be 31
synStreamFramePriority <- getWord8 2
_ <- getWord16be 14
- let nvhLength = fromIntegral (controlFrameLength header) - 10
- unless (nvhLength >= 1) $
- fail $ "SYN_STREAM: frame length too short, length = " ++ show nvhLength
- synStreamFrameNVHCompressed <- getByteString nvhLength
+ let contentLength = fromIntegral (controlFrameLength header)
+ unless (contentLength >= 11) $
+ fail $ "SYN_STREAM: frame length too short, length = " ++ show contentLength
+ synStreamFrameNVHCompressed <- getByteString (contentLength - 10)
return SynStreamControlFrame { .. }
getSynReplyStream :: ControlFrameHeader -> BitGet Frame

0 comments on commit f0e016d

Please sign in to comment.