HTTP has a polite question, and almost nobody asks it. A client that puts Expect: 100-continue in its request headers is saying: the body is ready in my hands, but I want your approval before I put it on the wire. If the server says "go ahead", a megabyte travels. If it says "no", nothing travels.
This week I asked that question on my own machine dozens of times. Two numbers came out of it: when the question goes unanswered the price is exactly one second, and when it is answered the saving is a megabyte. Whose fault the gap is remains unclear — every component in the path behaved correctly according to its own documentation.
There was a side effect too: the threshold in my head had been wrong for six years.
The rig
14 November 2026, my own laptop: macOS 26.6.2, Apple M4 Pro; curl 8.7.1, Node.js 22.16.0, Go 1.26.1 and nginx 1.29.8-alpine inside Docker 27.4.0. Client and server both sit on 127.0.0.1, so the delays below only show when one process turns back to the other.
Seeing who asks the question took a raw TCP listener: a short Node script that prints the headers verbatim, can choose to send 100 Continue or stay quiet, reads the body to the end and returns 204. It also holds the number I was really after — when the first byte of the body landed.
if (i >= 0) { // \r\n\r\n seen: headers are over
headersDone = true;
process.stdout.write(buf.slice(0, i).toString());
if (mode === 'continue') sock.write('HTTP/1.1 100 Continue\r\n\r\n');
}
A note on measurement hygiene: I threw my first round of numbers away. Five variants had run one after another on the same port number, and two rows contradicted themselves — one looked as if the request had never been sent, and the row with the suppressed Expect looked as if the header had gone out anyway. Something was clearly getting mixed up between one process shutting down and the next run starting; I never pinned down the exact root cause, and did not try to. Every variant got its own port, the contradiction disappeared, and the rows became repeatable. The numbers below are from that second round.
One byte, one second
The first question was simple: at what body size does curl add this header on its own? I sent the same request in three sizes against the silent server.
| Body |
Expect header sent |
First byte of body | curl total |
|---|---|---|---|
| 1,024 B | no | 0.3 ms | 0.01 s |
| 1,048,576 B (exactly 1 MiB) | no | 0.5 ms | 0.01 s |
| 1,048,577 B (1 MiB + 1 B) | yes | 1,003.8 ms | 1.01 s |
One byte, one second. The threshold is exactly 1 MiB and the comparison is strictly greater than: a whole mebibyte asks nothing, one byte more asks. The source says the same thing — curl's lib/http.h carries #define EXPECT_100_THRESHOLD (1024 * 1024), and addexpect() in lib/http.c adds the header under client_len > EXPECT_100_THRESHOLD || client_len < 0. That second condition matters: if the body length is unknown (chunked), permission is requested whatever the size turns out to be.
This is where my educated guess fell over. I had that threshold filed away as 1 KiB, and plenty of pages on the internet still say so. It was true — until 2020. curl 7.69.0 raised the threshold from 1024 to 1024*1024: a factor of a thousand. So the sentence "curl sends Expect on POSTs over 1 KB" has been wrong for six years, and I was still carrying it. You only notice this sort of thing by taking the measurement.
Where does the one second come from? curl picks its own waiting period and exposes it as --expect100-timeout; curl's own manual documents the default as one second, and in the code it sits in cr_exp100_read() as the comparison ms < data->set.expect_100_timeout. When the time is up curl does not give up — it sends the body anyway, and confesses in a single -v line:
> Expect: 100-continue
* Done waiting for 100-continue
Four variants, the same 1 MiB + 1 B body — each a separate run, which is why the first row sits a few milliseconds away from the third row of the table above:
| Scenario | First byte of body | curl total |
|---|---|---|
| Server stays quiet | 1,004.6 ms | 1.009 s |
Server sends 100 Continue
|
0.8 ms | 0.004 s |
--expect100-timeout 0.1 |
102.2 ms | 0.107 s |
Header suppressed with -H 'Expect:'
|
0.5 ms | 0.005 s |
In raw values that is 1.009073 s against 0.004401 s: a factor of more than two hundred riding on whether one header line gets answered. The first row went through four runs; the first byte of the body landed between 1,001 and 1,005 ms every time, so that one second comes out of the same place on every run. Politeness is free if the other party is polite too.
Go has the same number, but it arrives with the door shut. Go's client never adds this header by itself: when the same body went out through http.DefaultClient, the server saw no Expect at all and the request finished in 4 ms. With the header set by hand, Go waited exactly 1,000.5 ms — because DefaultTransport carries ExpectContinueTimeout: 1 * time.Second. The documentation spells out what zero means: send the body immediately, without waiting for the server to approve. Two separate teams, two languages, the same one second. No calculation produced that number; everyone copied it from everyone else.
Reading the rule changes who is at fault
Up to here I have painted the silent server as the villain. Reading the specification turned the picture around.
RFC 9110 §10.1.1 does not treat this wait as a one-sided wish; it gives orders to both ends. On the server side the language is firm: if an HTTP/1.1-or-later request carries 100-continue, the origin server MUST send either the final status code that the method, target and header fields already determine, or an immediate 100. There is a prohibition on top of that: the origin server MUST NOT wait for the content before sending the 100. Proxies get the same fork: either answer with a final status or forward the request inbound (MUST).
The client side, surprisingly, is left loose. The text names no specific duration; it says the client is not required to wait for any specific length of time, and draws its only line with a SHOULD NOT: it should not wait indefinitely. That is all it says about duration; the client has other obligations (it must not generate this expectation on a request with no content, for one), but the only bound on waiting is that SHOULD NOT. curl's one second and Go's one second are the same number two teams independently dropped into that gap.
The practical consequence: my raw listener, as the party that creates that one second, is the one breaking the rule. Against a well-behaved HTTP/1.1 server the delay never appears — it did not appear with nginx, and it did not appear with a default Node server. So when you see a one-second wait in the field, what you should be hunting is not "the price of the protocol" but a counterpart that ignores the rule: an application hook left half-finished, or an intermediary that does not care about this header. The next two sections measure exactly those two cases.
Who answers the question
The question has a recipient. Node.js's HTTP server answers it even if you do nothing: the documented wording is clear — if the 'checkContinue' event is not listened for, the server "will automatically respond with a 100 Continue as appropriate". That is what the timing showed: against a default Node server the same request finished in 0.011 s, with a 100 Continue on the wire.
The interesting part starts the moment you listen for that event. Adding a listener switches the automatic answer off and hands the responsibility to you — the docs say that too: when the event is handled, the 'request' event is never emitted. An application that adds the listener and forgets to call response.writeContinue() inside it keeps its customer waiting a full second on every large POST:
| Node server |
100 arrived |
Total |
|---|---|---|
| Default (no listener) | yes | 0.011 s |
'checkContinue' listened, no answer |
no | 1.012 s |
This is a bug that can easily go unnoticed for months. The requests succeed, the log says 204, no alarm fires; only every upload is one second longer. Black boxes spend their worst nights without telling anyone.
nginx, for its part, answers the question itself and never passes it on. In the local lab I put nginx in front as a reverse proxy with my raw listener behind it. nginx sent the client exactly one 100 Continue, the request finished in 0.019 s — and the headers the upstream server saw contained no Expect line at all:
POST / HTTP/1.1
Host: host.docker.internal:8777
Content-Length: 1048577
User-Agent: curl/8.7.1
The source confirms this in two separate places. The ngx_http_test_expect() function in src/http/ngx_http_request_body.c writes the literal "HTTP/1.1 100 Continue" CRLF CRLF straight into the socket. And the table that builds the upstream request in the proxy module carries this row: { ngx_string("Expect"), ngx_string("") } — an empty value, which in nginx's idiom means "do not pass this header". So the application behind nginx takes no part in this negotiation and never even learns its outcome.
You can make it pass through if you want. The line proxy_set_header Expect $http_expect; overrides the empty value in that table: with it in place the upstream server saw the Expect: 100-continue line and the request finished in 0.024 s. But nginx still gave the answer — the application staying quiet cost nobody a second. Passing the header through does not put the application in charge of the negotiation, it only keeps it informed.
There is a conformance wrinkle as well. The RFC says a server that sees an expectation it does not recognise MAY respond with 417 Expectation Failed. I asked with a made-up value, Expect: 200-ok: Node returned 417 (0.005 s), while nginx said nothing at all — it processed the request normally, returned 204, and again did not pass the header upstream. The reason is visible in the code: there is no path inside ngx_http_test_expect() that produces a 417 at all — if the value is not 100-continue, the function simply returns NGX_OK, and the expectation is silently ignored. Behind nginx a 417 can never be born; nginx does not produce one, and your application is not allowed to either.
A megabyte of profit
Looking at the tables so far, a reader could fairly ask: if the price is one second, why does this mechanism exist at all? To put a number on the answer I defined a small location in nginx — client_max_body_size 1k — and sent it the same 1 MiB + 1 B body.
| Request | Result | Bytes uploaded | Time |
|---|---|---|---|
With Expect: 100-continue
|
413 |
0 | 0.002 s |
Suppressed with -H 'Expect:'
|
413 |
1,006,159 – 1,048,577 | 0.003 s |
In all four runs the request that asked permission sent zero bytes; the one that did not ask sent 1,006,159, then 1,023,167, then 1,048,577, then 1,048,577 bytes. The lower bound moves from run to run, because there is a race between nginx writing its 413 and closing the connection and curl stopping its write; what does not move is the order of magnitude. The same rejected request: one sent not a single byte, the other put a megabyte on the wire and had the door slammed in its face halfway down the road. This mechanism is not about speed; it is about never sending bytes that are going to be refused.
The same profit can be measured at the application layer. I wrote one handler for Go's server and ran it two ways: one reads the body, the other returns 401 without touching it.
| Go handler | Result | Bytes uploaded | Time |
|---|---|---|---|
io.Copy(io.Discard, r.Body) |
204 |
1,048,577 | 0.002 s |
WriteHeader(401) without reading the body |
401 |
0 | 0.001 s |
The second row's secret is one sentence of documentation: the Go server sends the 100 (Continue) header on the first read from the request body. In Go, granting permission arrives as a side effect of starting to read the body. If you want to refuse, what you have to do is nothing at all — write the final status without touching r.Body. Early rejection is just a WriteHeader written three lines earlier.
Scaling it up is easy: at this blog's 16M limit, on a 1 Mbps uplink, pushing a doomed file all the way up takes roughly two minutes. I did not measure that; I derived it from the limit and the link speed — but even derived, it says enough about the bandwidth running into a drain on the server side. It resembles the lesson from the timeout semantics piece published here yesterday: where you think the client is keeping time, something else may be getting measured. There, a "timeout" turned out to be an hourglass set between two I/O events. Here, "one second" is not a calculation but a courtesy period.
Over HTTP/2 the question hangs in the air
Everything so far ran over HTTP/1.1. Two independent code bases say that is no accident.
nginx's ngx_http_test_expect() bails out quietly, before it even looks at the value, in these cases: the request version is below 1.1, r->stream != NULL (that is, it is an HTTP/2 stream), or r->connection->quic != NULL (HTTP/3). curl takes the same side: addexpect() only adds the header on its own while httpversion == 11. So both ends treat this feature as belonging to HTTP/1.1 — even though RFC 9113, which defines HTTP/2, shows in §8.8.5 exactly the case of answering a request that carries Expect: 100-continue with :status = 100. The specification permits it; the implementations do not use it.
I also took this measurement against my own site. I sent a POST with a 1 MiB + 1 B body to a path that does not exist (my site returns 403 from the edge for requests like this; the Server: cloudflare and CF-RAY response headers name who answered, so the three rows below describe that edge rather than my own nginx):
| Request |
Expect sent |
100 arrived |
Uploaded | Time (median of 4 runs) |
|---|---|---|---|---|
| Default (HTTP/2) | no | — | 1,048,577 B | 1.03 s (0.72–1.77) |
--http1.1 |
yes | yes | 1,048,577 B | 1.01 s (0.71–1.14) |
| HTTP/2 + header by hand | yes | no | 1,048,577 B | 1.79 s (1.69–1.95) |
These timings crossed the public internet, so they are noisy; the ranges in brackets show it. The solid result is not a number but the "no" in the third row: with the header set by hand over HTTP/2, no answer came, curl printed Done waiting for 100-continue, spent its full second, then sent the body regardless, and the request still ended in 403. Gain zero, cost one second. The second row got its 100 Continue but made no profit either: after the edge said "go ahead" it still returned 403, so the entire megabyte was wasted. For this mechanism to pay off, the party granting permission has to know about the refusal in advance.
The old-version side is closed off by the same logic. I put the Expect header by hand on an HTTP/1.0 request to the local nginx: no answer, a full 1.026 s. The same request over HTTP/1.1: 0.019 s. RFC 9110 §10.1.1 actually commands this — a server MUST ignore that expectation on an HTTP/1.0 request. nginx complies to the letter, and the waiting side pays for that compliance with one second.
Where my own stack stands
I looked at my own blog's live configuration and found something other than what I went looking for. The expected part first: client_max_body_size for this domain is 16M, so an upload over 16 MiB will be refused — over HTTP/1.1, if permission was asked, without a single byte of body. There is not one line in my application code mentioning checkContinue or writeContinue; it would not help if there were, since the nginx in front never passes that header upstream. This negotiation belongs to those two layers, not to my application.
What I did not expect was the version line: nginx/1.30.0, the release from 14 April 2026. The same stable branch reached 1.30.6 on 14 October, and the changelog in between carries five separate *) Security: entries — two buffer overflows in a worker process, a use-after-free with asynchronous file I/O, an uninitialised key in TLS session ticket rotation, and one where part of an unknown HTTP/3 frame can be taken for the request body and slip past the client_max_body_size limit. That last one does not touch me: the blog vhost has no quic listener, and all traffic is HTTP/1.1 and HTTP/2 over TLS. The others are open work.
I was going to close this section with "nothing to change". I am not closing it that way. There is a seven-month patch debt on that server, and a one-line version check run for this article is what surfaced it — I am not doing the upgrade here, because patching a live system should not be the side errand of an article run; it goes in its own maintenance window. The second risk is smaller and entirely in my own hands: if I ever add an upload endpoint, I might leave a 'checkContinue' listener half-finished. The 1.012 s row above is the invoice for that mistake.
A decision frame
The questions worth asking about this mechanism in your own setup, in order of weight:
-
Who refuses the upload? If the party that knows about the refusal early (a size limit, authentication, a quota) is also the party that can grant permission, the saving is real. For an application that only learns of the refusal after reading the body,
100-continueis just one round trip of latency. - Which version is on the wire? Over HTTP/2 or HTTP/3 this header will most likely go unanswered: gain zero, cost one second. Deliberately keeping an upload endpoint on HTTP/1.1 is a defensible choice.
-
Who sits in between? With a proxy like nginx in the path, the proxy answers the question and does not pass it on. If you think your application returns
417, look at the proxy's table first. - Does your client even ask? curl asks above 1 MiB or when the length is unknown; Go does not. Rather than assuming what your own client does, time it once against a silent server — the difference is a whole second, so it is visible to the naked eye.
-
Is the uploader a browser? You cannot send this header from one. In my own browser, building
new Request('/x', {method:'POST', headers:{'Expect':'100-continue'}, body:'...'})and listing its headers showed noExpectat all; putting the same value into a plainHeadersobject keeps it, so the stripping happens when the request is constructed. Uploads throughfetch()and XHR never engage this mechanism; the saving exists only on paths where you write the client yourself — curl, SDKs, server-to-server calls. -
Is the thing you measured yours? With a cloud edge, a load balancer or a WAF in front, the
100 Continueprobably comes from them. To learn what your own server says, you have to look at it directly.
The closing number is this: an unanswered courtesy question costs one second, an answered one saves a megabyte. Finishing the piece, I got curious about the mechanism's age, looked up its history, and found the opposite of what I expected. The first text of HTTP/1.1, RFC 2068 from January 1997, has neither the Expect header nor the 100-continue token — but the wait itself is there, and it is unconditional. §8.2 tells a server receiving such a request to "either respond with 100 (Continue) status and continue to read from the input stream, or respond with an error status" (MUST), and tells the client to send the header fields first and then wait for "either a 100 (Continue) response ... or with an error status" (MUST). RFC 2616 §14.20, in 1999, removed that obligation and put a header the client has to ask for in its place.
So the mechanism is twenty-nine years old, and its one big change was a retreat rather than an expansion: a rule everyone had to obey became a request anyone may make. In the twenty-seven years since, HTTP/2 left even that request unanswered. The most expensive thing in a protocol is not a wrong rule; it is a right question nobody answers.
Official Sources
- RFC 9110 §10.1.1 — the Expect header field
- RFC 9113 §8.8.5 — informational responses in HTTP/2
- RFC 2068 §8.2 — the unconditional 1997 form of the wait
- nginx source — ngx_http_test_expect() (who writes the 100 Continue)
- nginx source — the proxy module's table of headers not passed upstream
- Node.js — the http.Server 'checkContinue' event
- Go — net/http Transport.ExpectContinueTimeout
- curl source — the EXPECT_100_THRESHOLD definition
- curl — the --expect100-timeout option
Top comments (0)