make sure multipart parsing has enough bytes to compare against
parent
c45b188581
commit
0fc6dde178
|
@ -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?
|
||||
] [
|
||||
|
|
Loading…
Reference in New Issue