You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to handle Expect headers and I'm unsure if it's possible with httpure:
An origin server MUST, upon receiving an HTTP/1.1 (or later)
request-line and a complete header section that contains a
100-continue expectation and indicates a request message body will
follow, either send an immediate response with a final status code,
if that status can be determined by examining just the request-line
and header fields, or send an immediate 100 (Continue) response to
encourage the client to send the request's message body. The origin
server MUST NOT wait for the message body before sending the 100
(Continue) response.
It seems that since there's no listener on 'checkContinue' (purescript-node-http doesn't expose or handle the event and it doesn't look like anything is happening in this package), the underlying http module will always respond with 100 Continue and process the request. Is that right?
If so, can we add something to allow us to decide whether or not to respond with 100 Continue or some other code based on the request headers alone? E.g. if a client sends:
> POST /foo HTTP/1.1> Content-Type: application/json> Expect: 100-continue
And we know we cannot handle JSON, how do we respond with a 415 Unsupported Media Type? Or if a client sends:
> POST /foo HTTP/1.1> Content-Length: 123456789012345> Expect: 100-continue
And we know we're not going to handle giant requests, how would we respond with 413 Payload Too Large?
If we can add something that allows handling Expect: 100-continue, how would we send the 100 Continue line without closing the connection but reading the request? The model of httpure seems to be that you already have an HTTPure.Request.Request (with a body), and that you're working with that. Is there another way to handle things?
The text was updated successfully, but these errors were encountered:
Hmm, so I expect (heh, see what I did there?) that this would be covered by implementing streaming requests (see #63). I keep bumping that because I haven't really thought of an API that I particularly like, but I'm open to ideas.
Out of curiosity, what's the priority here? Is it mostly to be spec-compliant? I definitely think that this is something we should ideally support, but as it's a somewhat less-used part of the spec and it seems like support across servers and clients in the wild is pretty shotty anyways, I'm wondering if it's worth prioritizing the effort in httpure.
Hmm, streaming the request does seem like it might help deal with this. More than happy to put in some work once an API is settled.
It is spec-compliance–as I'm wanting to build something on top of httpure–but it's not quite that obscure. For instance, if you curl something larger than 1024 bytes, it sends an Expect: 100-continue header and acts accordingly. So long as the underlying node implementation will at least respond to that header we won't lose requests, but it would be nice to be able to control this when need be. So prioritize accordingly.
I'm trying to handle
Expect
headers and I'm unsure if it's possible withhttpure
:It seems that since there's no listener on
'checkContinue'
(purescript-node-http
doesn't expose or handle the event and it doesn't look like anything is happening in this package), the underlyinghttp
module will always respond with100 Continue
and process the request. Is that right?If so, can we add something to allow us to decide whether or not to respond with
100 Continue
or some other code based on the request headers alone? E.g. if a client sends:And we know we cannot handle JSON, how do we respond with a
415 Unsupported Media Type
? Or if a client sends:And we know we're not going to handle giant requests, how would we respond with
413 Payload Too Large
?If we can add something that allows handling
Expect: 100-continue
, how would we send the100 Continue
line without closing the connection but reading the request? The model ofhttpure
seems to be that you already have anHTTPure.Request.Request
(with a body), and that you're working with that. Is there another way to handle things?The text was updated successfully, but these errors were encountered: