-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
awscurl doesn't work for AWS Elasticsearch when query contains CJK multi-byte Unicode characters #106
Comments
Wow, what an issue report -- 5⭐. unicode and python seems to be a unique kind of pandora box. to the effect the the query comes back empty can you audit what is the query received by the ES and does it match to the one received when curl (when using open access)? |
OK. I will investigate. |
Hi, when Elasticsearch domain allows open-access, I could capture the JSON data by using https://everything.curl.dev/usingcurl/tls/sslkeylogfile See attached query-json.txt. Does |
I think verbose flag "-v" will print the request before it's sent.
…On Wed, Mar 17, 2021 at 8:01 PM Toshihiko Makita ***@***.***> wrote:
Hi, when Elasticsearch domain allows open-access, I could capture the JSON
data by using curl on Ubuntu and Wireshark. The main point is to set
SSLKEYLOGFILE environment variables before launching curl.
See attached query-json.txt.
query-json.txt
<https://github.com/okigan/awscurl/files/6161008/query-json.txt>
Does awscurl support SSLKEYLOGFILE environment variable? If it is
supported, I can send you the JSON dump file.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#106 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADUYXWHEBBLZ4PKEVRK573TEFUG3ANCNFSM4ZFTAWGQ>
.
|
Unfortunately "-v" option does not display the contents of JSON specified "-d" option. Results using
|
I had a related issue (trying to send a request that contains 0xff, which is an invalid byte in any UTF-8 sequence). I think that I fixed it by making this change to awscurl.py (line 490 in the current head): Original:
New:
|
It works fine if domain allows open-access
I'm confident that my query works fine if Elasticsearch domain allows open-access and I use
curl
command to issue query.I attached the search query: search-search-ngram-and-kuromoji-2.json zipped.
search-search-ngram-and-kuromoji-2.zip
If I launch
awscurl
without specifying--data-binary
, no search result returned.I have changed domain access policy to exhibit open access and allow one IAM role named ESFullAccess. Also ESFullAccess has trusted IAM user called ESProgram.
The command-line Windows Power shell
awsescurl.ps1
zipped.awsescurl.zip
If I launch
awscurl
with specifying--data-binary
, following error occurs.The command-line Windows Power shell
awsescurl-db.ps1
zipped.awsescurl-db.zip
Fixing TypeError
I rarely know Python, but from error message "TypeError: Unicode-objects must be encoded before hashing", I've modified following code from:
https://github.com/okigan/awscurl/blob/master/awscurl/awscurl.py line 200
to
because hashing payload should be done with encoding UTF-8 if
--data-binary
is specified or not.However modified awscurl still reports following error:
Last challenge: fixing "UnicodeEncodeError"
According to the error message, I modified the following code:
https://github.com/okigan/awscurl/blob/master/awscurl/awscurl.py line 135
to:
The error message has been vanished, but the query returns nothing.
Do you have any ideas to fix this problem?
Regards,
The text was updated successfully, but these errors were encountered: