* 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.
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.
Fixes#611
If you want/need to load data into a different es cluster just specify either the
* -H/--host option
* -p/--path option
ex: python load.py --host http://123.123.123.123:9200 -p /home/code/elasticsearch
* Adding start_elasticsearch.sh script to run elastic search on the host
in a docker container at http://localhost:9200
* update readme in instructions on how to use script
Before turning them into an authentication header, the user or password
supplied in hosts must be URL decoded.
The RFC https://tools.ietf.org/html/rfc3986 describes userinfo like:
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
and python documentation about urlparse says:
The components are not broken up in smaller parts (for example, the
network location is a single string), and % escapes are not expanded.
It is the caller job to unquote them before using them.
For instance, a character like "]" cannot be supplied in a host or
urllib will incorrectly interpret it using ipv6 syntax.
Fix#568