Skip to content

Conversation

@tonybaloney
Copy link
Contributor

Since there is no longer a secure/insecure connection class, they are one and the same.

This change adds new tests to check that

  • When a connection is defined as secure, the connection class will use the https scheme.
  • When a connection scheme implies a port, the port is not included in the URL
  • When a connection defines secure and an unusual port, the scheme is propagated

It uncovered 1 issue with secure connections not being explicit for unusual ports.

@tonybaloney
Copy link
Contributor Author

@Kami this is the second change to fix the issue you mentioned.

@tonybaloney
Copy link
Contributor Author

merging

@asfgit asfgit merged commit e5d2cfd into apache:trunk Jan 10, 2017
asfgit pushed a commit that referenced this pull request Jan 10, 2017

def __init__(self, host, port, **kwargs):
def __init__(self, host, port, secure=None, **kwargs):
scheme = 'https' if secure is not None and secure else 'http'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the defaults would be more clear if this read:

def __init__(self, host, port, secure=None, **kwargs):
    if secure is None and port == 443:
        secure = True
    scheme = 'https' if secure else 'http'

    # ... rest of the code

I dislike inline logic because it is hard to find for the casual reader.

Also, a docstring would be nice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

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.

3 participants