Skip to content

Fix SOCKS4 proxy error message and IOCP accept-context socket (#5486)#5684

Merged
pepone merged 2 commits into
zeroc-ice:mainfrom
pepone:fix/5486-misc
Jun 23, 2026
Merged

Fix SOCKS4 proxy error message and IOCP accept-context socket (#5486)#5684
pepone merged 2 commits into
zeroc-ice:mainfrom
pepone:fix/5486-misc

Conversation

@pepone

@pepone pepone commented Jun 23, 2026

Copy link
Copy Markdown
Member

Addresses #5486 (items 1, 12). One of a set of PRs splitting the grouped transport audit.

  • A rejected SOCKS4 proxy connection reported an "HTTP proxy error" (copy-pasted from the HTTP proxy path); it now names the SOCKS4 proxy.
  • TcpAcceptor passed the accepted socket as the SO_UPDATE_ACCEPT_CONTEXT option value; per the WinSock AcceptEx contract it must be the listening socket. It now passes _fd (the listening socket) instead of _acceptFd.

Item 1 compiles on macOS; item 12 is Windows-only (verified against the Microsoft AcceptEx docs). Codex-audited.

- A rejected SOCKS4 proxy connection reported an "HTTP proxy error"
  (copy-pasted from the HTTP proxy path); it now names the SOCKS4 proxy.
- TcpAcceptor passed the accepted socket as the SO_UPDATE_ACCEPT_CONTEXT
  option value; per the WinSock AcceptEx contract it must be the
  listening socket. Pass _fd instead of _acceptFd.

Addresses zeroc-ice#5486 (items 1, 12).
Copilot AI review requested due to automatic review settings June 23, 2026 12:52
@pepone pepone added the cpp label Jun 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Fixes misleading proxy error reporting and corrects WinSock IOCP accept-context handling per AcceptEx contract.

Changes:

  • Update SOCKS4 rejection path to report “SOCKS4 proxy error” instead of “HTTP proxy error”.
  • Fix SO_UPDATE_ACCEPT_CONTEXT usage to pass the listening socket _fd rather than the accepted socket _acceptFd.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cpp/src/Ice/TcpAcceptor.cpp Corrects SO_UPDATE_ACCEPT_CONTEXT option value to use the listening socket per WinSock contract.
cpp/src/Ice/NetworkProxy.cpp Fixes SOCKS4 proxy rejection message to reference the correct proxy type.

Comment thread cpp/src/Ice/TcpAcceptor.cpp Outdated
}
if (setsockopt(_acceptFd, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char*)&_acceptFd, sizeof(_acceptFd)) ==
SOCKET_ERROR)
// SO_UPDATE_ACCEPT_CONTEXT takes the listening socket (_fd) as its option value, not the accepted

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment that explains the new correct path/API usage is fine (within reason). But no need to mention what "not do do".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude: Done in 0d02e9c — dropped the comment entirely. Now that the call is correct it is a standard setsockopt we would not normally annotate.

@pepone pepone merged commit b1cdb62 into zeroc-ice:main Jun 23, 2026
46 checks passed
pepone added a commit that referenced this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants