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* ;
|
[ t >>end-of-stream? ] if* ;
|
||||||
|
|
||||||
: maybe-fill-bytes ( multipart -- multipart )
|
: 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 )
|
: split-bytes ( bytes separator -- leftover-bytes safe-to-dump )
|
||||||
dupd [ length ] bi@ 1- - short cut-slice swap ;
|
dupd [ length ] bi@ 1- - short cut-slice swap ;
|
||||||
|
@ -65,6 +65,7 @@ ERROR: end-of-stream multipart ;
|
||||||
[ dump-until-separator ] with-string-writer ;
|
[ dump-until-separator ] with-string-writer ;
|
||||||
|
|
||||||
: read-header ( multipart -- multipart )
|
: read-header ( multipart -- multipart )
|
||||||
|
maybe-fill-bytes
|
||||||
dup bytes>> "--\r\n" sequence= [
|
dup bytes>> "--\r\n" sequence= [
|
||||||
t >>end-of-stream?
|
t >>end-of-stream?
|
||||||
] [
|
] [
|
||||||
|
|
Loading…
Reference in New Issue