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

Add support for https parameter to force https even on non-443 port #47

Merged
merged 2 commits into from
Jan 14, 2016

Conversation

OverloadUT
Copy link
Collaborator

Backwards compatible!

This is necessary for connecting directly to plex media servers securely when they are running not on port 443 (which is always). I have tested this is an actual app and it works :)

There is a teeny tiny corner case issue which I think is acceptable for the sake of backwards compatibility: if you supply both port: 443 and https: false, it will still use https due to the port number. I can't imagine this will ever come up in a legitimate scenario though.

@@ -18,6 +18,7 @@ function PlexAPI(options, deprecatedPort) {

this.hostname = hostname;
this.port = deprecatedPort || opts.port || PLEX_SERVER_PORT;
this.https = opts.https || false;
Copy link
Owner

Choose a reason for hiding this comment

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

this.https = opts.https;

Could that possibly fix the (rare) issue you're describing?

There is a teeny tiny corner case issue which I think is acceptable for the sake of backwards compatibility: if you supply both port: 443 and https: false, it will still use https due to the port number.

Cause then line #197 could be

return this.https === true || (this.port === 443 && this.https === undefined) ? 'https://' : 'http://';

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, that makes more sense! I'll add another commit. I might break out that logic in to a couple lines because it's becoming a little hard to read for a ternary.

Copy link
Owner

Choose a reason for hiding this comment

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

I might break out that logic in to a couple lines ...

👍

@OverloadUT
Copy link
Collaborator Author

Should be ready for merging now :)

@phillipj
Copy link
Owner

Nice 👍

phillipj added a commit that referenced this pull request Jan 14, 2016
Add support for `https` parameter to force https even on non-443 port
@phillipj phillipj merged commit ffe53dc into master Jan 14, 2016
@phillipj phillipj deleted the support-explicit-https branch January 14, 2016 06:48
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

2 participants