title: CookieError: Illegal key value
body: <p>I use <a href="http://webpy.org" rel="noreferrer">web.py</a>, which internally uses the <a href="http://docs.python.org/library/cookie.html#Cookie.SimpleCookie" rel="noreferrer"><code>cookie.SimpleCookie</code></a> class to load cookies incoming from the user's browser.</p>
  
  <p>Occasionally, I get exceptions like:</p>
  
  <pre><code>...
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 455, in set
      raise CookieError("Illegal key value: %s" % key)
  CookieError: Illegal key value: SinaRot/g/news.sina.com.cn
  </code></pre>
  
  <p>The offending character seems to be the forward slash (<code>/</code>), which, according to my reading of  <a href="http://www.ietf.org/rfc/rfc2109.txt" rel="noreferrer">RFC 2109</a> (cookies) and <a href="http://www.ietf.org/rfc/rfc2068.txt" rel="noreferrer">RFC 2068</a> (HTTP 1.1) should be disallowed, so that's OK.</p>
  
  <p>I don't set this cookie, and I'm not sure why or how it got set for my domain (a proxy, perhaps?), but that's irrelevant; the larger issue is that simplecookie fails hard when it encounters this cookie, and returns an error to the user.</p>
  
  <p>So, my question is: is there any way to ask <code>SimpleCookie</code> to simply ignore cookies that are invalid, but return the rest? I couldn't find anything obvious in the docs to do this.</p>