Re: [tornado] AsyncHTTPClient: NULL byte in POST body?

24 views
Skip to first unread message

Ben Darnell

unread,
May 8, 2022, 8:25:51 PM5/8/22
to Tornado Mailing List
This certainly isn't something that AsyncHTTPClient would do on purpose, and I can't think of how such a bug would happen. I think we've had one report of this in the past that turned out to be user error but I can't remember the details and search is failing me. The most useful things to debug this would be snippets of source code and/or (decrypted) packet captures. Also note whether you're using the default implementation of AsyncHTTPClient or curl_httpclient and whether it differs between those two modes.

-Ben

On Sun, May 8, 2022 at 9:39 AM Adrian <aflit...@gmail.com> wrote:
Hey Ben,

I'm making various calls to S3 using the REST API. They all work well, except one.

Calls to "DeleteObjects" take an XML-formatted POST body. AWS returns this error:

"DeleteObject error parsing: XML syntax error on line 1: illegal character code U+0000"

I've tested the call using python-requests and I get no such error. The API call works.

My assumption here is that AsyncHTTPClient is introducing a NULL byte into the POST body, somehow. Is there a way I can verify this and is there a workaround?

Thanks,
Adrian


--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-tornado/8e6fe869-9f82-484f-9414-075f142a3dban%40googlegroups.com.

Adrian

unread,
May 17, 2022, 5:17:01 AM5/17/22
to Tornado Web Server
Hey Ben,

I deleted this thread because I solved it in the end. Further debugging revealed no such NULL byte.

The difference between python-requests and AsyncHTTPClient is the latter uses application/x-www-form-urlencoded for POST requests, where no Content-Type is specified.

So it was a parsing issue on the AWS side triggered by that Content-Type. I used application/xml instead and the API call worked.

Regards,
Adrian
Reply all
Reply to author
Forward
0 new messages