-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix support for HTTP proxies #11245
Merged
Merged
Fix support for HTTP proxies #11245
Conversation
This file contains 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
Hidden services can only be accessed with an HTTP proxy, in which case the host seen by the Socket class will be the proxy, not the target host. Hidden services are already filtered in `Request#initialize`.
ClearlyClaire
force-pushed
the
fixes/http-proxy
branch
4 times, most recently
from
July 6, 2019 13:42
319064c
to
59575f3
Compare
Avoid the timeout logic being bypassed
ClearlyClaire
force-pushed
the
fixes/http-proxy
branch
from
July 6, 2019 13:45
59575f3
to
055594b
Compare
ClearlyClaire
force-pushed
the
fixes/http-proxy
branch
from
July 6, 2019 14:00
a0ba4da
to
267278b
Compare
I haven't tested hidden services, but I have tested access with and without an HTTP proxy, as well as reverse-proxies failing to connect (this indeed fixed hanging processes). EDIT: requesting a review from hcmiya because they were the one to add the hidden service code in the first place |
Gargron
approved these changes
Jul 6, 2019
ClearlyClaire
added a commit
to ClearlyClaire/mastodon
that referenced
this pull request
Jul 7, 2019
* Disable incorrect check for hidden services in Socket Hidden services can only be accessed with an HTTP proxy, in which case the host seen by the Socket class will be the proxy, not the target host. Hidden services are already filtered in `Request#initialize`. * Use our Socket class to connect to HTTP proxies Avoid the timeout logic being bypassed * Add support for IP addresses in Request::Socket * Refactor a bit, no need to keep the DNS resolver around
hiyuki2578
pushed a commit
to ProjectMyosotis/mastodon
that referenced
this pull request
Oct 2, 2019
* Disable incorrect check for hidden services in Socket Hidden services can only be accessed with an HTTP proxy, in which case the host seen by the Socket class will be the proxy, not the target host. Hidden services are already filtered in `Request#initialize`. * Use our Socket class to connect to HTTP proxies Avoid the timeout logic being bypassed * Add support for IP addresses in Request::Socket * Refactor a bit, no need to keep the DNS resolver around
messenjahofchrist
pushed a commit
to Origin-Creative/mastodon
that referenced
this pull request
Jul 30, 2021
* Disable incorrect check for hidden services in Socket Hidden services can only be accessed with an HTTP proxy, in which case the host seen by the Socket class will be the proxy, not the target host. Hidden services are already filtered in `Request#initialize`. * Use our Socket class to connect to HTTP proxies Avoid the timeout logic being bypassed * Add support for IP addresses in Request::Socket * Refactor a bit, no need to keep the DNS resolver around
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.
The
Request::Socket
class implements its own logic for connection timeouts, to give us a bit more control, and becausehttp.rb
uses the ill-advisedTimeout::timeout
. That latter mechanism is bypassed entirely. Therefore, not using ourSocket
class means we do not have proper handling of connection timeouts.This PR changes that by using our custom class for both direct connections and connections through a proxy—in which case the socket class is used to connect to the proxy.
Additionally, since the socket is used to connect to the proxy, it will never get used with a hidden service as
host
, so removed the additional check.Also added support for IP addresses in addition to hostnames.