Repository navigation
Send Typhoeus proxy headers with Ethon 0.19 proxyheader - #45
Draft
proxymeshai wants to merge 1 commit into
Draft
proxymeshai wants to merge 1 commit into
proxymeshai wants to merge 1 commit into
Conversation
Ethon 0.19 exposes CURLOPT_PROXYHEADER. Pass proxy headers as a proxyheader list with headeropt: :separate, and read the CONNECT response from the first response_headers block. Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft. Native libcurl proxy headers for the Typhoeus adapter, based on main.
Summary
RubyProxyHeaders::Typhoeusused to send HTTPS requests with proxy headers throughRubyProxyHeaders::NetHTTP.request, which is not defined. Ethon 0.19 (Typhoeus 1.7, released 2026-10-28) exposes:proxyheader(CURLOPT_PROXYHEADER) and:headeropt(:unified/:separate).The adapter now:
Ethon::Curl::Slistfromproxy_headersand passes it as:proxyheaderwithheaderopt: :separate, so those headers are sent only to the proxy. On HTTPS, that is the CONNECT request. Application:headersstay on the tunneled request.response_headers(the block whose status line saysConnection established) and exposes it asproxy_response_headerswith lowercase names, the same shape Net::HTTP uses. Typhoeus'sresponse.headersremains the origin response only, soX-ProxyMesh-IPis read fromproxy_response_headers.Dependencies
The gemspec still has no runtime dependency on Typhoeus or Ethon. Callers install Typhoeus themselves. Development dependencies are now
typhoeus~> 1.7andethon~> 0.19(the adapter builds the slist throughEthon::Curl::Slist). The lockfile resolves typhoeus 1.7.1 and ethon 0.19.1. Typhoeus 1.7.1 requires ethon>= 0.19.1because 0.19.0 rejectedEasy#cleanupfromon_complete.Typhoeus 1.7's upgrade notes (callback exceptions, fork safety, enum validation) do not change this adapter's call shape. It does rely on 1.7's
response.headersbeing the last header block.Overlap with #43
Draft PR #43 (
cursor/fix-connect-headers-53ba) is behind main and also editslib/ruby_proxy_headers/typhoeus.rb,DEFERRED.md,README.md,docs/typhoeus.md, the gemspec,Gemfile.lock, andtest/test_proxy_headers.rb. That branch routes Typhoeus HTTPS through patchedNet::HTTPbecause Ethon 0.18 did not exposeCURLOPT_PROXYHEADER. This PR supersedes that Typhoeus path with the native option. The two drafts will conflict if both land; the Net::HTTP, Faraday, and CI work in #43 is otherwise separate.Tests
Ruby 3.2.3, Typhoeus 1.7.1, Ethon 0.19.1, libcurl 8.5.0:
bundle exec rspec— 34 examples, 0 failures, 6 pending (the pending examples are the existing unimplementedConnection.parse_proxy_url/build_auth_headercases).spec/typhoeus_spec.rbstubs Typhoeus for option wiring and CONNECT-block parsing, and runs a local mock proxy plus TLS origin. CONNECT carriedX-ProxyMesh-Countryand did not carryX-App-Secret; the origin request carriedX-App-Secretand did not carryX-ProxyMesh-Country;proxy_response_headers['x-proxymesh-ip']was203.0.113.10and that name was absent fromresponse.headers.test/test_proxy_headers.rbnow includes atyphoeusmodule for the livePROXY_URLharness. That harness was not run here (no proxy secret in this environment).Left unresolved
PROXY_URLintegration was not executed.DEFERRED.md).0.2.3. The change is recorded under Unreleased.