Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support uploads (100 Continue) #878

Open
mleonhard opened this issue Mar 11, 2022 · 4 comments
Open

Support uploads (100 Continue) #878

mleonhard opened this issue Mar 11, 2022 · 4 comments

Comments

@mleonhard
Copy link

mleonhard commented Mar 11, 2022

How can a Tide handler send a tide::StatusCode::Continue response with no body and then later send a full response?

I am deploying an API server which uses Tide. I'm deploying it on Heroku. When Heroku's load balancer forwards a request to a server, the server must send some data back within 30 seconds, otherwise the load balancer closes the connection with a 503 [0]. This means that when a slow client takes more than 30 seconds to send the request body, the request fails. This is a problem for clients uploading 10MB image files over unreliable mobile Internet connections. Such uploads often take more than 30 seconds. The solution is to send a 100 Continue response before reading the request body.

[0] https://devcenter.heroku.com/articles/request-timeout

@mleonhard mleonhard changed the title 100 Continue Support uploads (100 Continue) Mar 11, 2022
@jbr
Copy link
Member

jbr commented Apr 12, 2022

Because it uses async-h1, tide should by default send a 100 continue to any client that sends an Expect: 100-continue header async-h1#110 — if it does not, that's a bug. If the client does not send the expect header, I do not believe it is valid to send a 100 continue status

@mleonhard
Copy link
Author

How about adding a test for it?

@jbr
Copy link
Member

jbr commented May 3, 2022

It is tested in async-h1.

@ArtemGr
Copy link

ArtemGr commented Dec 7, 2022

https://gms.tf/when-curl-sends-100-continue.html mentions cURL having --expect100-timeout SECS, which is useful to test 100-continue: set the timeout to a large value and then cURL will either hang waiting for the header, or will proceed immediately if the header is present.

I've tested it with

echo 123 > 123.txt
curl --expect100-timeout 321 -vT 123.txt https://a-webdav-url

and I see tide 0.16 returning 100-continue NP (when we decide to read the body, that is)

< HTTP/1.1 100 Continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< content-length: 0
< date: Wed, 07 Dec 2022 14:11:10 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants