Skip to content

fix(httpclient): respect HTTP_PROXY/HTTPS_PROXY for streaming client#238

Open
Atarit0 wants to merge 1 commit into
bjarneo:mainfrom
Atarit0:fix/respect-http-proxy
Open

fix(httpclient): respect HTTP_PROXY/HTTPS_PROXY for streaming client#238
Atarit0 wants to merge 1 commit into
bjarneo:mainfrom
Atarit0:fix/respect-http-proxy

Conversation

@Atarit0
Copy link
Copy Markdown

@Atarit0 Atarit0 commented May 20, 2026

Summary

The Streaming HTTP client in internal/httpclient/client.go sets a custom http.Transport (to disable HTTP/2 for Icecast/SHOUTcast compatibility and to extend the header timeout) but doesn't set Proxy, so it silently ignores the HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables.

This makes cliamp unusable for anyone behind a corporate or local proxy: the rest of the codebase relies on http.DefaultTransport, which already honors those vars via http.ProxyFromEnvironment, so playback is the only thing that breaks — which is the most visible feature, and the failure mode (silent EOF / hang) is hard to diagnose.

The fix

One-line addition: Proxy: http.ProxyFromEnvironment in the streaming http.Transport. Brings the streaming client in line with Go's default behavior and the rest of cliamp.

 var Streaming = &http.Client{
   Transport: &http.Transport{
+    Proxy:                 http.ProxyFromEnvironment,
     ResponseHeaderTimeout: 30 * time.Second,
     TLSNextProto:          make(map[string]func(authority string, c *tls.Conn) http.RoundTripper),
   },
 }

Tested

  • Built locally and confirmed strings cliamp | grep ProxyFromEnvironment returns the symbol.
  • Verified playback works through both an HTTPS proxy and a SOCKS-over-SSH tunnel (HTTPS_PROXY=socks5://localhost:<port>).
  • No effect when the env vars are unset (Go's ProxyFromEnvironment returns nil → behavior identical to current code).

Why this is safe

http.ProxyFromEnvironment is the same helper used by http.DefaultTransport. With no proxy env vars set, the call is a no-op and the transport behaves exactly as before. With proxy env vars set, the streaming client gains the behavior every other HTTP client in cliamp already has.

Summary by CodeRabbit

  • Bug Fixes
    • Network connectivity now properly respects environment proxy settings, improving access for users behind corporate or local proxies.

Review Change Stack

The Streaming HTTP client defines a custom http.Transport without setting
Proxy, so it ignores HTTP_PROXY, HTTPS_PROXY and NO_PROXY env vars. This
breaks playback for users behind corporate or local proxies, even though
the rest of the codebase (which relies on http.DefaultTransport) already
honors those vars.

Add Proxy: http.ProxyFromEnvironment to the streaming Transport so it
behaves consistently with the rest of cliamp.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d1600a30-9278-4c02-83c4-a7365dc3b4e4

📥 Commits

Reviewing files that changed from the base of the PR and between 94ba80c and 0c03496.

📒 Files selected for processing (1)
  • internal/httpclient/client.go

📝 Walkthrough

Walkthrough

The Streaming HTTP client's transport is configured to respect HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables by setting Transport.Proxy to http.ProxyFromEnvironment. Inline comments document this change to support corporate and local proxy users.

Changes

HTTP Client Proxy Configuration

Layer / File(s) Summary
Streaming client proxy support
internal/httpclient/client.go
The http.Transport in the shared Streaming HTTP client now sets Proxy to http.ProxyFromEnvironment to enable environment-based proxy configuration (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) for corporate and local proxy users, with supporting documentation comments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: enabling HTTP/HTTPS proxy support in the streaming client.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant