HTTPProxyServer should not send Content-Length header in successful responses to CONNECT requests
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 327
- Forks
- 112
- Avg merge
- 4h 2m
- Merged PRs (30d)
- 1
Description
According to RFC7231,
A server MUST NOT send any Transfer-Encoding or Content-Length header fields in a 2xx (Successful) response to CONNECT.
However, I tried the example code on https://docs.ruby-lang.org/en/2.2.0/WEBrick/HTTPProxyServer.html
require 'webrick'
require 'webrick/httpproxy'
proxy = WEBrick::HTTPProxyServer.new Port: 8000
trap 'INT' do proxy.shutdown end
trap 'TERM' do proxy.shutdown end
proxy.start
and sent a request through this proxy
$ ALL_PROXY=http://localhost:8000 curl -I https://www.google.com/
and it showed
HTTP/1.1 200 OK
Server: WEBrick/1.7.0 (Ruby/3.1.0/2021-12-25)
Date: Wed, 26 Jan 2022 03:48:33 GMT
Content-Length: 0
Connection: close
...
You can see the Content-Length header is there, and it does cause problems for some kinds of clients.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the WEBrick::HTTPProxyServer example and the provided curl command to reproduce the header. Then trace the HTTPProxyServer handling of CONNECT responses. Done means successful 2xx CONNECT responses no longer include Content-Length or Transfer-Encoding, consistent with RFC7231.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100