* Use original SSL process and add SSLContext
Not going to deprecate and replace with SSLContext.
But instead give option for using SSLContext next to the original way of
handling SSL.
This wasn't an issue before as scheme=https was not documented but now
it is in the docs and it makes this entire block be skipped if url is
given without scheme and no ssl_context is passed completely breaking
ssl
outside. However, `Urllib3HttpConnection` did not use these headers but
only its default ones.
With this commit, `Urllib3HttpConnection` will either use the default
ones or merge the default headers with the provided ones if there are
any.
Relates #618
Bug with OSX made breaking changes to the way certifi was being imported
and used.
Unable to reproduce with Linux.
Found improper logic. Fixed now.
Also changing removing the flag for checking `verify_certs` as
it is `True` by default. Don't want to make users flag that as
`False` just to make things work.
A connection to an SSL instance should be:
es = Elasticsearch("https://host:port", http_auth=(user,pass))
* If using Elastic Cloud or some other publicly recognized certificate
that certifi can recognize.
Also don't want to break backwards compat. So when chcking for depreicated values ignore
the check on verify_certs. Since it's True. the verify certs will be default true
in the ssl_context. And can be turned off in the SSL context when using it.
* Fixes non UTF-8 surrogateescapes
Surrogate escapes in Unicode (non UTF-8 encoding) will be properly escaped with backslashes when encountered, versus breaking the transport layer.
* Removes erroneous bytes decode and reraises
Fixes to re-raise exceptions with different reasons
Removes erroneous bytes decode where bytes are desired
* Adds test for surrogate escapes in body
Tests that a surrogate escape sequence is properly escaped
with backslashes to produce valid UTF-8.
* Use proper byte sequence for surrogate
* Use if/else versus pass
* Proper Unicode surrogate escape
Use a Unicode Surrogate that properly escapes in both Python2 and Python3
* Passing test once surrogatepass is used
Updating test to pass once surrogatepass is used
* Use surrogatepass instead of backslashreplace
This replicates behavior between Python 2 and Python 3
* Fixes whitespace
* Simplifies with no exception block
Since `surrogatepass` will only ever explicitly occur when there are surrogate bytes encountered, there is no need to let the error throw and catch it, also uses single-quotes for consistency.
* Fixes Unicode Surrogate Escapes in request logging
This is the same fix as accepted for ElasticSearch requests, except applied to the request logging mechanisms.