http-rs / http-rs/surf

Simple POST requests are getting split into 2 frames

Open
#278 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
128
PR merge metrics
No merged PRs in 30d

Description

I'm working on an application for which getting the network latency down to a minimum is critical. I've noticed that when I use surf (with the curl_client) that for every HTTP POST request, I'm doing 2 complete round trips. (I'm already using a preexisting connection and have TCP_NODELAY enabled.)

From using wireshark, I can see that surf is first sending a HTTP frame with just the headers, waiting for an ACK from the remote server, and then finally sending the body (which is only about 20 bytes long).

As a workaround, I'm routing the request through a local HTTP proxy, which makes the ACK of the first frame very quick, and the proxy ends up combining the header and body into a single frame before sending it to the remote server, so I effectively only have 1 (remote) round trip.

Is there any way to force surf to send both the header and body in a single frame? Or if I'm misunderstanding something (quite possible), how can I further debug the extra round trip?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.