Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipv6 address triggers cookie exception #4761

Closed
boeckmann opened this issue Jan 6, 2014 · 2 comments · Fixed by #4762
Closed

ipv6 address triggers cookie exception #4761

boeckmann opened this issue Jan 6, 2014 · 2 comments · Fixed by #4762
Milestone

Comments

@boeckmann
Copy link

Error Summary

When accessing IPython Notebook via an ipv6 ip address a http.cookies.CookieError is raised:

http.cookies.CookieError: Illegal key value: username-[2001-4dd0-2030-0-ba27-ebff-fe7c-a4b4]-8888

The URL was http://[2001:4dd0:2030:0:ba27:ebff:fe7c:a4b4]:8888/

System Information

{'codename': 'An Afternoon Hack',
 'commit_hash': '7c2ea3a',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/usr/lib/python3.3/site-packages/IPython',
 'ipython_version': '1.1.0',
 'os_name': 'posix',
 'platform': 'Linux-3.10.25-1-ARCH-armv6l-with-arch',
 'sys_executable': '/usr/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.3.3 (default, Nov 29 2013, 11:19:14) \n[GCC 4.7.2]'}

Traceback

HTTPRequest(protocol='http', host='[2001:4dd0:2030:0:ba27:ebff:fe7c:a4b4]:8888', method='GET', uri='/', version='HTTP/1.1', remote_ip='2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6', headers={'Accept-Encoding': 'gzip, def
late', 'Dnt': '1', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0', 'Connection': 'keep-alive', 'Accept-Language': 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3', 'Accept'
: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Host': '[2001:4dd0:2030:0:ba27:ebff:fe7c:a4b4]:8888'})
Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 1141, in _when_complete
    callback()
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 1162, in _execute_method
    self._when_complete(method(*self.path_args, **self.path_kwargs),
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 2284, in wrapper
    if not self.current_user:
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 906, in current_user
    self._current_user = self.get_current_user()
  File "/usr/lib/python3.3/site-packages/IPython/html/base/handlers.py", line 116, in get_current_user
    self.clear_login_cookie()
  File "/usr/lib/python3.3/site-packages/IPython/html/base/handlers.py", line 107, in clear_login_cookie
    self.clear_cookie(self.cookie_name)
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 443, in clear_cookie
    domain=domain)
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 423, in set_cookie
    self._new_cookie[name] = value
  File "/usr/lib/python3.3/http/cookies.py", line 492, in __setitem__
    self.__set(key, rval, cval)
  File "/usr/lib/python3.3/http/cookies.py", line 486, in __set
    M.set(key, real_value, coded_value)
  File "/usr/lib/python3.3/http/cookies.py", line 366, in set
    raise CookieError("Illegal key value: %s" % key)
http.cookies.CookieError: Illegal key value: username-[2001-4dd0-2030-0-ba27-ebff-fe7c-a4b4]-8888
ERROR:tornado.application:Uncaught exception GET / (2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6)
HTTPRequest(protocol='http', host='[2001:4dd0:2030:0:ba27:ebff:fe7c:a4b4]:8888', method='GET', uri='/', version='HTTP/1.1', remote_ip='2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6', headers={'Accept-Encoding': 'gzip, def
late', 'Dnt': '1', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0', 'Connection': 'keep-alive', 'Accept-Language': 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3', 'Accept'
: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Host': '[2001:4dd0:2030:0:ba27:ebff:fe7c:a4b4]:8888'})
Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 1141, in _when_complete
    callback()
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 1162, in _execute_method
    self._when_complete(method(*self.path_args, **self.path_kwargs),
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 2284, in wrapper
    if not self.current_user:
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 906, in current_user
    self._current_user = self.get_current_user()
  File "/usr/lib/python3.3/site-packages/IPython/html/base/handlers.py", line 116, in get_current_user
    self.clear_login_cookie()
  File "/usr/lib/python3.3/site-packages/IPython/html/base/handlers.py", line 107, in clear_login_cookie
    self.clear_cookie(self.cookie_name)
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 443, in clear_cookie
    domain=domain)
  File "/usr/lib/python3.3/site-packages/tornado/web.py", line 423, in set_cookie
    self._new_cookie[name] = value
  File "/usr/lib/python3.3/http/cookies.py", line 492, in __setitem__
    self.__set(key, rval, cval)
  File "/usr/lib/python3.3/http/cookies.py", line 486, in __set
    M.set(key, real_value, coded_value)
  File "/usr/lib/python3.3/http/cookies.py", line 366, in set
    raise CookieError("Illegal key value: %s" % key)
http.cookies.CookieError: Illegal key value: username-[2001-4dd0-2030-0-ba27-ebff-fe7c-a4b4]-8888
2014-01-06 22:28:10.570 [tornado.access] ERROR | 500 GET / (2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6) 109.15ms
ERROR:tornado.access:500 GET / (2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6) 109.15ms
2014-01-06 22:28:10.755 [tornado.access] WARNING | 404 GET /favicon.ico (2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6) 21.05ms
WARNING:tornado.access:404 GET /favicon.ico (2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6) 21.05ms
2014-01-06 22:28:10.794 [tornado.access] WARNING | 404 GET /favicon.ico (2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6) 19.79ms
WARNING:tornado.access:404 GET /favicon.ico (2001:4dd0:2030:0:6aa8:6dff:fe46:d8f6) 19.79ms
@minrk
Copy link
Member

minrk commented Jan 6, 2014

can you test #4762?

@boeckmann
Copy link
Author

Works! Thanks!

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants