Skip to content
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

Forcing content-type to 'application/octet-stream' breaks SQS requests. #9

Closed
obmarg opened this issue Oct 20, 2015 · 4 comments · Fixed by #12
Closed

Forcing content-type to 'application/octet-stream' breaks SQS requests. #9

obmarg opened this issue Oct 20, 2015 · 4 comments · Fixed by #12

Comments

@obmarg
Copy link
Contributor

obmarg commented Oct 20, 2015

I've been trying to get aiobotocore working with SQS, but was getting errors because the content-type being sent with the request was always set to application/octet-stream when SQS requires application/x-www-form-urlencoded.

I've managed to track this down to these lines https://github.com/jettify/aiobotocore/blob/master/aiobotocore/endpoint.py#L105-L112 that hard-code application/octet-stream. I assume these were needed somehow for S3, but they stop the usual botocore content-type code from working. As far as I can tell, the content-type would usually be set in https://github.com/boto/botocore/blob/082a8b8e564b12500ff3de4d048f89d56d33d67d/botocore/vendored/requests/models.py#L460

I've tried removing the application/octet-stream hard coding here and it does seem to fix SQS. I haven't thoroughly tested it though.

@jettify
Copy link
Member

jettify commented Oct 20, 2015

Thanks for report! There reason for hard coding content-type was that in old version aiohttp there was no way to skip it. aiohttp simply added this header before sending request. When botocore calculates signature, content type is not present but added later, this leads to 403 error due to wrong signature.

New aiohttp has a way to skip auto generated headers aio-libs/aiohttp#507 so I need update aiobotocore to use this features.

I have never tested aiobotocore with SQS (only with s3), I glad to hear that it is working :)

@alanc10n
Copy link

alanc10n commented Dec 4, 2015

Obmarg's patch appears to work with SQS but breaks S3 (I get a SignatureDoesNotMatch error on S3 PutObject operations).

@jettify
Copy link
Member

jettify commented Dec 6, 2015

@obmarg @alanc10n I have dropped hard coded content-type (f70cc48), new version should work for both: SQS and S3. Could you tests new version?

@jettify jettify reopened this Dec 6, 2015
@obmarg
Copy link
Contributor Author

obmarg commented Dec 7, 2015

This seems to have fixed SQS support - thanks!

@jettify jettify closed this as completed Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants