Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Open
rdodev opened this Issue Mar 6, 2013 · 0 comments

Comments

Projects
None yet
1 participant
Contributor

rdodev commented Mar 6, 2013

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:
  do_stuff()

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