Open nigredo-tori opened 8 years ago
Is this not just a Nim stdlib issue?
Since Jester fails for valid HTTP, I'd say it's Jester issue in the first place.
I can no longer reproduce this, has it been fixed?
I can confirm as well that the initial example works. I suspect it was fixed on client side by this PR: https://github.com/nim-lang/Nim/pull/5711 . Jester still seems to choke on preamble, though:
Server:
import jester, asyncdispatch
from nativesockets import Port
settings:
port = Port(1234)
bindAddr = "127.0.0.1"
routes:
post "/mp":
let fd = request.formData
assert fd.hasKey("foo")
resp("OK")
runForever()
Http request:
POST /mp HTTP/1.1
Host: localhost
Content-Type: multipart/form-data; boundary=XX
Content-Length: 66
--XX
Content-Disposition: form-data; name="foo"
bar
--XX--
Sending this makes the server close the connection, though the program itself doesn't crash like before (at least on Windows).
httpclient
overhaul triggered this bug in Jester. It now crashes on multipart message with non-empty preamble part. Example code:This fails with the following error message:
Here's the reason: old (deprecated) and new
postContent
versions differ in HTTP they output; in particular the new version's output has an extra empty line before the first boundary. This line should be considered part of the preamble (as specified in RFC1341), and ignored.