Skip to content

How to Implement custom proxy logic #1788

Answered by Tratcher
SpringHgui asked this question in General
Discussion options

You must be logged in to vote

Keep in mind that the ConnectCallback is not called per request. Streams returned from the ConnectCallback go into SocketHttpHandler's connection pool and are re-used for all requests being sent to the same host. SocketHttpHandler will close the Stream when it's done with the connection.

HttpContext.RequestAborted should not be used in this callback since that is a per request event.

Even if the client closes the browser/connection, that doesn't mean the ConnectCallback stream should be closed, since it can be re-used by other clients that are sending requests to the same destination.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by adityamandaleeka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Idea This issue is a high-level idea for discussion.
3 participants
Converted from issue

This discussion was converted from issue #1771 on June 30, 2022 18:12.