If I have got the sequence of http requests, like the following:
handle.spawn(build_and_send_request_with_body("body for the 1st request"));
handle.spawn(build_and_send_request_with_body("body for the 2nd request"));
handle.spawn(build_and_send_request_with_body("body for the 3rd request"));
will the requests be sent in the order of spawning using a single http connection?
Thanks, how can I send a bunch of HTTP data in async way (i.e. the second part being send not waiting for the first part to respond), but in the order: the first part is written to the socket before the second (assuming http2 connection)?
let f = build_and_send_request_with_body("1")
.and_then(|_| build_and_send_request_with_body("2"))
.and_then(|_| build_and_send_request_with_body("3"));
handle.spawn(f);
Good point. I have forgotten that it is not http2 ready, but I heard it is ready if protocol negotiation is not required. Let's say it supports, how can it be expressed using futures?
Good point. Do not know. I would expect messages going through one connection are not shuffled, but it seems nginx can shuffle it because it uses multiple http1 connections in the back office.
Ok. Practically I need to rethink my design. Now it becomes a theoretical excercise I guess it would be easier on the lower layer than hyper or reqwest.