actix / actix/actix-web

actix web client can hide HTTP responses when streaming

Offen
#2,109 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
A-awc needs-investigation
Vorherrschende Sprache
Rust
Sterne
24.8k
Forks
1.9k
Ø Merge
23 Std. 10 Min.
Gemergte PRs (30 T.)
26

Beschreibung

## Expected Behavior
The client receives the HTTP response sent from the downstream server.

## Current Behavior
The client receives an error after experiencing an Os error 32 (broken pipe).

## Steps to Reproduce (for bugs)
[This fork][1] modifies the `http-proxy` example so it can be run with the actix
web client _or_ with `reqwest`. Following those steps, when using the actix
web client, I receive a 502 (which is what I return in the case of a request error)
after a few minutes. When using the `reqwest` client, I receive a 200 in a few
seconds.

## Context
We have an actix proxy between two actix servers. S1 -> S2 -> S3. Data is streamed
from S1 -> S2 using `reqwest` and then S2 -> S3 using the actix web client. Occasionally
S3 will respond with a 400 very quickly (before S2 has finished streaming the payload).
In these cases, S2 never sees the 400 in the code - the `send_stream().await` call simply
returns the Os error. We're unable to tell if we should return a 500 (because there was
a downstream 500 error) or a 400 (because the user sent one but we never saw it).

My assumption was we're running into something similar to [this][2] where S2 tries to send
more data but S3 has closed the connection and we get a broken pipe. I don't know how
`reqwest` is handling this properly - maybe it handles this error internally and throws it away
after doing a read and seeing that the client did send back a response :shrug:.

## Your Environment

* Rust Version (I.e, output of `rustc -V`): 1.48.0
* Actix Web Version: 3.3.2 (also reproduced with 4.0.0-beta.4 in examples)
* Actix Web Client Version: 2.0.3 (also reproduced with 3.0.0-beta.3 in examples)

[1]: https://github.com/mlodato517/examples/tree/mlodato517/test-forwarding-clients/basics/http-proxy
[2]: https://stackoverflow.com/a/33371232/2891835

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.