-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from rethinkdb/feature/wildcard-certs-hostname
Feature/wildcard certs hostname
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
import six | ||
|
||
|
||
def decode_utf8(string, encoding='utf-8'): | ||
if hasattr(string, 'decode'): | ||
return string.decode(encoding) | ||
|
||
return string | ||
|
||
|
||
def chain_to_bytes(*strings): | ||
return b''.join([six.b(string) if isinstance(string, six.string_types) else string for string in strings]) | ||
|
||
|
||
def get_hostname_for_ssl_match(hostname): | ||
parts = hostname.split('.') | ||
|
||
if len(parts) < 3: | ||
return hostname | ||
|
||
parts[0] = '*' | ||
return '.'.join(parts) |
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
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