make sure multipart parsing has enough bytes to compare against

db4
Doug Coleman 2009-02-06 22:56:46 -06:00
parent c45b188581
commit 0fc6dde178
1 changed files with 2 additions and 1 deletions

View File

@ -42,7 +42,7 @@ ERROR: end-of-stream multipart ;
[ t >>end-of-stream? ] if* ;
: maybe-fill-bytes ( multipart -- multipart )
dup bytes>> [ fill-bytes ] unless ;
dup bytes>> length 256 < [ fill-bytes ] when ;
: split-bytes ( bytes separator -- leftover-bytes safe-to-dump )
dupd [ length ] bi@ 1- - short cut-slice swap ;
@ -65,6 +65,7 @@ ERROR: end-of-stream multipart ;
[ dump-until-separator ] with-string-writer ;
: read-header ( multipart -- multipart )
maybe-fill-bytes
dup bytes>> "--\r\n" sequence= [
t >>end-of-stream?
] [