CaseInsensitiveDict __setitem__ faulty for differing-case keys

I think I figured out the cause of the issue described here: https://github.com/kennethreitz/requests/pull/59

It appears that if one isn't careful to use a common case convention when assigning a header after it has been assigned before, the header will fail to work. The request will use the old header value... I think I know why, too. Here's an example:

test.py

``` python

from requests.structures import CaseInsensitiveDict

print "Initializing CID = CaseInsensitiveDict()"
CID = CaseInsensitiveDict()

print "Setting 'spam': 'eggs'"
CID['spam'] = 'eggs'
print "Setting 'Spam': 'Eggs'"
CID['Spam'] = 'Eggs'
print "Setting 'sPAM': 'eGGS'"
CID['sPAM'] = 'eGGS'

print "Contents of CID:", CID
print "CID['spam']: '%s'" % CID['spam']
print "CID['Spam']: '%s'" % CID['Spam']
print "CID['sPAM']: '%s'" % CID['sPAM']

print "\n\n\n"

print "Initializing CID = CaseInsensitiveDict()"
CID = CaseInsensitiveDict()

print "Setting 'sPAM': 'eGGS'"
CID['sPAM'] = 'eGGS'
print "Setting 'Spam': 'Eggs'"
CID['Spam'] = 'Eggs'
print "Setting 'spam': 'eggs'"
CID['spam'] = 'eggs'

print "Contents of CID:", CID
print "CID['spam']: '%s'" % CID['spam']
print "CID['Spam']: '%s'" % CID['Spam']
print "CID['sPAM']: '%s'" % CID['sPAM']
```

The output:

```
Initializing CID = CaseInsensitiveDict()
Setting 'spam': 'eggs'
Setting 'Spam': 'Eggs'
Setting 'sPAM': 'eGGS'
Contents of CID: {'sPAM': 'eGGS', 'Spam': 'Eggs', 'spam': 'eggs'}
CID['spam']: 'eggs'
CID['Spam']: 'eggs'
CID['sPAM']: 'eggs'

Initializing CID = CaseInsensitiveDict()
Setting 'sPAM': 'eGGS'
Setting 'Spam': 'Eggs'
Setting 'spam': 'eggs'
Contents of CID: {'spam': 'eggs', 'Spam': 'Eggs', 'sPAM': 'eGGS'}
CID['spam']: 'eGGS'
CID['Spam']: 'eGGS'
CID['sPAM']: 'eGGS'
```

Notice how in both passes, only the first assignment actually "works". It stores the data for all three assignments, but will only return the value set by the initial key.

I believe the only change necessary would be to the **setitem** method on CaseInsensitiveDict:

Broken:

``` python
    def __setitem__(self, key, value):
        dict.__setitem__(self, key, value)
        self._clear_lower_keys()
```

Fixed:

``` python
    def __setitem__(self, key, value):
        dict.__setitem__(self, key.lower(), value)
        self._clear_lower_keys()
```

When I use the corrected module, the CaseInsensitiveDict behaves as I believe it should:

```
Initializing CID = CaseInsensitiveDict()
Setting 'spam': 'eggs'
Setting 'Spam': 'Eggs'
Setting 'sPAM': 'eGGS'
Contents of CID: {'spam': 'eGGS'}
CID['spam']: 'eGGS'
CID['Spam']: 'eGGS'
CID['sPAM']: 'eGGS'

Initializing CID = CaseInsensitiveDict()
Setting 'sPAM': 'eGGS'
Setting 'Spam': 'Eggs'
Setting 'spam': 'eggs'
Contents of CID: {'spam': 'eggs'}
CID['spam']: 'eggs'
CID['Spam']: 'eggs'
CID['sPAM']: 'eggs'
```

Note that the value for that key is the last one assigned, instead of the first.

If needed, I can put together a pull request for this, but it might take some time since I've never done it before :)


The same issue arises when initializing a CaseInsensitiveDict using a dictionary of differing-case keys or differing-case keyword arguments. Example:

```
>>> from requests.structures import CaseInsensitiveDict
>>> CaseInsensitiveDict(a=1, A=2, B=3)
{'A': 2, 'a': 1, 'B': 3}
>>> CaseInsensitiveDict({'a': 1, 'A': 2, 'B': 3})
{'A': 2, 'a': 1, 'B': 3}
```

I'm not sure what the best approach is to addressing this issue, since we are going to run into problems with Cookie and Set-Cookie headers.  The first, sends cookies in a semi-colon delimited fashion, whereas the latter sends a unique header for each cookie being set. In the case of Set-Cookie, some clients (such as Firefox) do not parse headers whose values were combined with a comma as delimiter as suggested in http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2. Though neither does `Cookie.SimpleCookie`:

```
>>> SimpleCookie('Set-Cookie: a=1; b=2')['a']
<Morsel: a='1'>
>>> SimpleCookie('Set-Cookie: a=1; b=2')['b'] 
<Morsel: b='2'>
>>> SimpleCookie('Set-Cookie: a=1, b=2')['a'] # incorrect?
<Morsel: a='1,'>
>>> SimpleCookie('Set-Cookie: a=1, b=2')['b']
<Morsel: b='2'>
>>> SimpleCookie('Set-Cookie: a=1 b=2')['a'] 
<Morsel: a='1'>
>>> SimpleCookie('Set-Cookie: a=1 b=2')['b']
<Morsel: b='2'>
```

urllib3 combines headers with a comma as well: https://github.com/shazow/urllib3/blob/master/urllib3/response.py#L174

Since the CaseInsensitiveDict is used as a container for HTTP headers, would it make more sense to change values to be lists instead of strings?


We should fix this.


I've submitted a pull request to address this issue. Behavior when initializing a case-insensitive dict with differing-case keys is undefined, as is the case when initializing a dict with multiple values for the same key.


Original PRs to fix this were apparently not merged. Fixed in e6e9b55.