actix / actix/actix-web

actix web client can hide HTTP responses when streaming

Đang mở
#2,109 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
A-awc needs-investigation
Ngôn ngữ chính
Rust
Star
24.8k
Fork
1.9k
Merge trung bình
23 giờ 10 phút
Pull request đã merge (30 ngày)
26

Mô tả

## 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.