fix(adt): honor HTTP_PROXY/HTTPS_PROXY for WebSocket connections#107
Open
dme007 wants to merge 1 commit into
Open
fix(adt): honor HTTP_PROXY/HTTPS_PROXY for WebSocket connections#107dme007 wants to merge 1 commit into
dme007 wants to merge 1 commit into
Conversation
Extends the oisee#13 fix (a1af66f — "honor HTTP_PROXY/HTTPS_PROXY environment variables") from the HTTP transport to the WebSocket path. vsp connects to /sap/bc/apc/sap/zadt_vsp over gorilla/websocket for the ABAP debugger, AMDP debugger, RFC execution, report execution, and abapGit WebSocket export — all routed through a single BaseWebSocketClient in pkg/adt/websocket_base.go. Neither the websocket.Dialer nor the transient HTTP client used on the 401-retry pre-auth path set a Proxy, so on SAP Business Application Studio destinations (where all outbound traffic must go through a Connectivity Proxy) the WebSocket-backed tools fail to connect even though the HTTP-only tools work fine after oisee#13. Two small package-level constructors in websocket_base.go so the dialer and pre-auth client are created in a single, testable place: newZADTVSPDialer(tlsConfig) → websocket.Dialer{ Proxy: http.ProxyFromEnvironment, HandshakeTimeout: 30s, TLSClientConfig: tlsConfig, } newPreAuthHTTPClient(jar, tlsConfig) → &http.Client with Transport.Proxy = http.ProxyFromEnvironment The two inline blocks in BaseWebSocketClient.Connect now call these constructors; dialer.Jar = jar on the 401-retry path stays unchanged. No behavioural change for deployments that don't use an HTTP proxy — http.ProxyFromEnvironment returns nil when HTTP_PROXY / HTTPS_PROXY / NO_PROXY are unset, so the dialer connects directly as before. Regression coverage: TestNewZADTVSPDialer_HonoursProxyEnv — dialer.Proxy non-nil, TLS config and handshake timeout preserved. TestNewPreAuthHTTPClient_HonoursProxyEnv — transport.Proxy non-nil, supplied jar is used, timeout non-zero. Mirrors the style of TestNewHTTPClient at pkg/adt/config_test.go: 171-192 that locks in the HTTP-side oisee#13 fix. Fixes: WebSocket-mode equivalent of oisee#13 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.
Summary
Extends #13 (a1af66f — "honor HTTP_PROXY/HTTPS_PROXY environment variables")
from the HTTP transport to the WebSocket path. On SAP Business Application
Studio destinations (Cloud Connector + Connectivity Proxy) every outbound
connection must go through the proxy; the HTTP-only tools started working
after #13 but every WebSocket-backed feature still failed to connect.
All WebSocket traffic in vsp — ABAP debugger, AMDP debugger, RFC execution,
report execution, abapGit WebSocket export — runs through a single
BaseWebSocketClientinpkg/adt/websocket_base.go. Neither thewebsocket.Dialernor the transient*http.Clientused on the 401-retrypre-auth path set a
Proxy, soHTTP_PROXY/HTTPS_PROXYwere ignoredfor WebSocket connects.
The fix
Two small package-level constructors in
websocket_base.goso the dialerand the pre-auth client are created in a single, testable place:
The two inline blocks in
BaseWebSocketClient.Connectnow call theseconstructors;
dialer.Jar = jaron the 401-retry path stays unchanged.Behaviour for non-proxy deployments
Unchanged.
http.ProxyFromEnvironmentreturnsnilwhenHTTP_PROXY/HTTPS_PROXY/NO_PROXYare unset, so the dialer connects directlyas before. Same semantics
net/httpuses by default.Regression coverage
Mirrors the style of
TestNewHTTPClientatpkg/adt/config_test.go:171-192that locks in the HTTP-side #13 fix.
Files changed
Related issues
equivalent; same motivation, same environment, same semantics.