Skip to content
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

Added unix domain socket support to http.proxy #1813

Merged
merged 1 commit into from
Jul 3, 2017

Conversation

georgi-d
Copy link

@georgi-d georgi-d commented Jul 3, 2017

  • changed the HTTPReverseProxySettings class to hold a destination URL instead
    of (host, port)
  • added reverseProxyRequest overload with URL
  • updated the proxy handler logic
  • made getFilteredHost() public

Copy link
Member

@s-ludwig s-ludwig left a comment

Choose a reason for hiding this comment

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

Using a URL for the proxy destination makes a lot of sense! It's a welcome side-effect that this this also enables HTTPS destinations.

@@ -1118,7 +1118,7 @@ final class HTTPClientResponse : HTTPResponse {
}

/** Returns clean host string. In case of unix socket it performs urlDecode on host. */
private auto getFilteredHost(URL url)
auto getFilteredHost(URL url)
Copy link
Member

Choose a reason for hiding this comment

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

I'd leave this as package for now, because the place here isn't really fitting for a public API.

/// The destination port to forward requests to
ushort destinationPort;
/// The destination URL to forward requests to
URL destination;
Copy link
Member

Choose a reason for hiding this comment

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

This should get some backwards-compatibility properties:

/// Scheduled for deprecation - use `destination.host` instead.
@property ushort destinationPort() const { return destination.port; }
/// ditto
@property void destinationPort(ushort port) { destination.port = port; }

/// Scheduled for deprecation - use `destination.host` instead.
@property string destinationHost() const { return destination.host; }
/// ditto
@property void destinationHost(string host) { destination.host = host; }

To make that fully work, there would also need to be a default value of URL("http", "") for destination.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review. I will address the comments.

@codecov
Copy link

codecov bot commented Jul 3, 2017

Codecov Report

Merging #1813 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1813      +/-   ##
==========================================
- Coverage   37.05%   37.01%   -0.04%     
==========================================
  Files          81       81              
  Lines       10885    10895      +10     
==========================================
  Hits         4033     4033              
- Misses       6852     6862      +10
Impacted Files Coverage Δ
http/vibe/http/client.d 65.97% <ø> (ø) ⬆️
http/vibe/http/proxy.d 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0437d5d...c893e97. Read the comment docs.

- changed the HTTPReverseProxySettings class to hold a destination URL instead
of (host, port)
- added reverseProxyRequest overload with URL
- updated the proxy handler logic
- made getFilteredHost() package level
@georgi-d
Copy link
Author

georgi-d commented Jul 3, 2017

I have addressed the comments.

Copy link
Member

@s-ludwig s-ludwig left a comment

Choose a reason for hiding this comment

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

Okay, thanks! Looks good to merge now.

@s-ludwig s-ludwig merged commit 64a63e2 into vibe-d:master Jul 3, 2017
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.

None yet

3 participants