By passing a `Retry` object to `urlopen` instead of just `False`, it
prevents `urllib3` from having to create a Retry object with `from_int`.
`from_int` emits an undesirable log message when called with
`retries=False`, and this can be avoided by the method described above.
* Adding GZip support to urllib3
* Adding compression documentation and example
* Convert to lowercase for consistency
* Moving header manipulation to __init__()
* Validating headers for compression
* Moving body compression out of the headers block
* Don't compress if there is no body
* Infer true
* 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.
* Fix scheme for HTTPS URLs
For URLs like https://example.org scheme is currently set to 'http'.
* Revert "Fix scheme for HTTPS URLs"
This reverts commit 5dcee5bd2a8ce4453b495e637b283e7558718262.
* Fix HTTPS URL support
As per [their blog post of the 27th April](https://blog.readthedocs.com/securing-subdomains/) ‘Securing subdomains’:
> Starting today, Read the Docs will start hosting projects from subdomains on the domain readthedocs.io, instead of on readthedocs.org. This change addresses some security concerns around site cookies while hosting user generated data on the same domain as our dashboard.
AFAIK the only exception which can occur here is one that the json.loads(..) could raise. So (TypeError or) ValueError.
So except on that. and also log a warning in such case.
bare excepts are 99.99% of the time simply bad/wrong. It's the case here.
https://github.com/elastic/elasticsearch-py/issues/344
Add a client_key parameter to complement the client_cert parameter. If
client_key is used, it is assumed that client_cert will contain only the
certificate, not the combined cert and key in a single file.
Closes#344