Skip to content
This repository

Case-Sensitive check for headers, can cause duplicate headers being sent to services #1370

rdodev opened this Issue March 06, 2013 · 0 comments

1 participant

Ruben Orduz
Ruben Orduz

Caveat: Although I discovered this bug while using the an instance of S3::Key, it's possible we're checking for headers in the same case-sensitive fashion elsewhere in boto.

When sending in custom headers to one of set_contents_from_* methods, once the headers ultimately get passed to send_file method, boto checks for headers along the lines of:

if 'Such-And-Such' in headers:

for some headers a default value is assigned if none is found in the headers dictionary being passed in. Since the check above will only match keys with exact casing it will add the default value + the ones being passed in but didn't match the casing (e.g 'Content-Type' != 'content-type') both will be bundled in the request causing unexpected errors.

I suggest looking throughout boto and whenever header existence checks are performed, do it in case insensitive manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.