benhoskings/babushka — pull request #242 by bradfeehan (2012-12-16 04:31:42+00:00)
Title: Case-insensitive regex to detect Location header

The Resource class follows `Location:` headers when fetching resources using `curl`. The location header is detected manually using `.val_for('Location')`, however according to [RFC 2616][1], the field names for HTTP message headers should be case-insensitive.

[1]:

This pull request changes the string `'Location'` to the regex `/^location:/i`, which should match all valid permutations of case for this header.

I discovered this when I noticed that Dropbox use `location` (all lowercase) to redirect to the latest version of their client software, as you can see by running the following command:

```bash
curl -I 'https://www.dropbox.com/download?plat=mac'
```

@richo told me I should provide a spec for any pull requests but I couldn't see any existing tests for this class. This is also my first public pull request *ever* and I'm not really a Ruby programmer, but I'm learning! If tests are really required, some examples or advice would be really appreciated.