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

Ports should be specified in CURLOPT_PORT, not in the host #782

Merged
merged 8 commits into from
Jun 13, 2019

Conversation

afrozenpeach
Copy link
Contributor

Because the host is adding the port, the host header also has the port in it. Instead, the handler should be using CURLOPT_PORT to specify which port is the curl request is being sent on.

This also affects unit tests that no longer need to verify that the port is in the host name.

Rather than including the port in the host, which also makes the host header include the port, the port should be assigned using the CURLOPT_PORT option.
Fix tests so that they are no longer checking for the host to have the port in them as welll
Now that port isn't a part of the hostname, move it to be it's own member variable
Now that the port is being stored separately from the host, we should be asserting that the port is stored correctly.
The connection interface also needs the new port member variable and get function
Accidentally added a comment start
This fixes the failing ClientTest
@polyfractal
Copy link
Contributor

On the run at the moment so haven't looked at this closely... but does it matter? My understanding is that regardless of where the port is specified (in the URL or in the curl options) the end result is the same?

@polyfractal
Copy link
Contributor

Ahh I see your comment in #548 (comment). Makes sense. Will try to take a closer look at this later today, or on monday at the latest.

Thanks for the PR!

@afrozenpeach
Copy link
Contributor Author

Having the port in the host header is optional, it technically works, but can cause some problems in some setups. For my purposes, we use an HAProxy instance in front of the elasticsearch server. The HAProxy instance looks at the host header for routing, and having the port in the host header throws things off.

This is just a more proper way of doing things, and prevents some confusion and frustration when the host header is important.

Plus, having the port split out as it's own member variable is, in my opinion, cleaner than it is being in the host.

@fullmoonissue
Copy link

Hello @polyfractal,

May I ping you about this PR ?

Is there anything missing before merging ?

Regards,

@nicomro
Copy link

nicomro commented May 23, 2019

Hi @polyfractal ,
Any news ? I hope you are fine.
IMHO, it is still an issue.
Can this PR be merged ?
Regards,

@nicomro
Copy link

nicomro commented May 23, 2019

Maybe someone else can handle this PR.
@ezimuel ?

@ezimuel
Copy link
Contributor

ezimuel commented May 23, 2019

Thanks @nicomro for the remind. I'll review this PR asap and hopefully merge with 7.0.0 release.

@ezimuel ezimuel self-assigned this Jun 13, 2019
@ezimuel ezimuel merged commit 9ecc8ff into elastic:master Jun 13, 2019
@ezimuel
Copy link
Contributor

ezimuel commented Jun 13, 2019

Just merged in master for 7.0.0 release. Thanks @afrozenpeach for this PR!

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.

6 participants