Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_proxy example no longer works #2950

Closed
andrewhickman opened this issue Aug 18, 2022 · 1 comment · Fixed by #2953
Closed

http_proxy example no longer works #2950

andrewhickman opened this issue Aug 18, 2022 · 1 comment · Fixed by #2953
Labels
A-docs Area: documentation. C-bug Category: bug. Something is wrong. This is bad! E-easy Effort: easy. A task that would be a great starting point for a new contributor.

Comments

@andrewhickman
Copy link
Contributor

andrewhickman commented Aug 18, 2022

Version
git bisect says the first bad commit is 0c8ee93

Platform
64-bit (Windows)

Description
When running the http_proxy example, it does not work with powershell's Invoke-WebRequest -Proxy command.

Server output:

> cargo run --features=full --example http_proxy
Listening on http://127.0.0.1:8100
req: Request { method: CONNECT, uri: example.com:443, version: HTTP/1.1, headers: {"host": "example.com:443", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Microsoft Windows 10.0.19042; en-GB) PowerShell/7.2.5"}, body: Body(Empty) }
upgrade error: upgrade expected but low level API in use

Client output:

> Invoke-WebRequest https://example.com -Proxy http://127.0.0.1:8100
Invoke-WebRequest: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine..

Using the previous commit, I get the expected client output:

> iwr https://example.com -Proxy http://127.0.0.1:8100

StatusCode        : 200
StatusDescription : OK
Content           : <!doctype html> ...

I will test with curl when I get a chance

@andrewhickman andrewhickman added the C-bug Category: bug. Something is wrong. This is bad! label Aug 18, 2022
@seanmonstar
Copy link
Member

Thanks for noticing this! I think the fix is just adding .with_upgrades() after .serve_connection in the example. Would you like to file a PR fixing it? :D

@seanmonstar seanmonstar added E-easy Effort: easy. A task that would be a great starting point for a new contributor. A-docs Area: documentation. labels Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation. C-bug Category: bug. Something is wrong. This is bad! E-easy Effort: easy. A task that would be a great starting point for a new contributor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants