[issue34226] cgi.parse_multipart() requires undocumented CONTENT-LENGTH in Python 3.7

2019-09-03 Thread Niklas Sombert


Change by Niklas Sombert :


--
nosy: +ytvwld

___
Python tracker 
<https://bugs.python.org/issue34226>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34226] cgi.parse_multipart() requires undocumented CONTENT-LENGTH in Python 3.7

2020-06-12 Thread Niklas Sombert


Niklas Sombert  added the comment:

Since there's the easy workaround of just setting pdict["CONTENT-LENGTH"] I 
personally don't have a problem with this staying the way it is.

But it would be really nice if this were documented somewhere.

--

___
Python tracker 
<https://bugs.python.org/issue34226>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2018-09-11 Thread Niklas Sombert


New submission from Niklas Sombert :

Today I tried to access URLs like this one: http://user:1...@example.net:8080.

The result was this:
>>> import urllib.request
>>> urllib.request.urlopen("http://user:1...@example.net:1234/";)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 956, in send
self.connect()
  File "/usr/local/lib/python3.7/http/client.py", line 928, in connect
(self.host,self.port), self.timeout, self.source_address)
  File "/usr/local/lib/python3.7/socket.py", line 707, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
  File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: 


At first, I checked my network connection, but that turned out to be okay. Even 
funnier:

>>> urllib.request.urlopen("http://user:1...@example.net/";) 
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/http/client.py", line 877, in _get_hostport
port = int(host[i+1:])
ValueError: invalid literal for int() with base 10: '1...@example.net'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
  File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1285, in do_open
h = http_class(host, timeout=req.timeout, **http_conn_args)
  File "/usr/local/lib/python3.7/http/client.py", line 841, in __init__
(self.host, self.port) = self._get_hostport(host, port)
  File "/usr/local/lib/python3.7/http/client.py", line 882, in _get_hostport
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
http.client.InvalidURL: nonnumeric port: '1...@example.net'

So, urllib seems to have problems parsing HTTP URLs which contain a userinfo 
part. (Requests works.)

--
components: Library (Lib)
messages: 325022
nosy: ytvwld
priority: normal
severity: normal
status: open
title: urllib.request.urlopen fails when userinfo is present in URL
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 
<https://bugs.python.org/issue34628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2018-09-12 Thread Niklas Sombert


Niklas Sombert  added the comment:

Thank you for your response.

But if this is an explicit choice, I would like to have better exceptions:

>>> from http.client import HTTPConnection
>>> h = HTTPConnection("user:1...@example.net")
raises http.client.InvalidURL: nonnumeric port: '1234@example.n
et'
>>> h = HTTPConnection("user:1...@example.net:1234")
doesn't raise any exception.

--

___
Python tracker 
<https://bugs.python.org/issue34628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2018-10-05 Thread Niklas Sombert


Niklas Sombert  added the comment:

Hey, this is almost a month old. (Not a problem, really. But I thought, I 
should bump this.)

--

___
Python tracker 
<https://bugs.python.org/issue34628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2018-11-09 Thread Niklas Sombert


Niklas Sombert  added the comment:

Another month has passed, just saying.

--

___
Python tracker 
<https://bugs.python.org/issue34628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2018-11-10 Thread Niklas Sombert


Niklas Sombert  added the comment:

This behaviour would be better than the current one, yes.

--

___
Python tracker 
<https://bugs.python.org/issue34628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com