[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-11-22 Thread STINNER Victor

STINNER Victor added the comment:

Ah, on IRC Xiang told me that send_header("Connection", 1) raises an
error. Right, *this* specific case raises an error. But I don't think
that it's worth to require text for HTTP header values.

If you consider that it's a shame, Python should handle this corner
case (sorry, what is use case for "Connection: 1" ? :-D), please open
a new issue.

If you consider that the doc the HTTP server must be more explicit on
the accepted types, please mention that integers are accepted for
values, not only text.

--

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-11-22 Thread STINNER Victor

STINNER Victor added the comment:

Mathieu: "For consistency, all header values should be str."

Xiang: issue27414_v2.patch: Doc/library/http.server.rst
"*keyword* and *value* should both be :class:`str`."

I'm sorry, but I don't understand the whole point of this issue. The current 
code works, I don't see any good reason to change it.

The unit test is a little bit complex for a little tiny implementation detail. 
Usually, we try to avoid unit tests on implementation details in the Python 
test suite.

It's perfectly fine to pass an integer to an HTTP value, it's just super 
convenient.

I checked the HTTP client: the type of the 'argument' parameter of putheader() 
is not documented neither, so I think that it's just fine to leave the doc 
unchanged.

I close now this issue NOTABUG.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-11-22 Thread Xiang Zhang

Xiang Zhang added the comment:

v2 applies the suggestions.

--
priority: low -> normal
versions: +Python 3.7
Added file: http://bugs.python.org/file45597/issue27414_v2.patch

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-11-21 Thread STINNER Victor

STINNER Victor added the comment:

issue27414.patch is not good: see my review.

--
nosy: +haypo

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Delete by other test cases without restoring? Which is rather impossible to 
happen. But I'd like it to stay like now. It is not complex and straight when 
reading. I don't want to change it to swap_attr.

--

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-25 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-24 Thread Berker Peksag

Berker Peksag added the comment:

In which case would the send_header method be absent?

--

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-24 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for the reply berker. It's nice to know this helper. :) But I'd like to 
keep it as now since I don't see any real advantage to use it and swap_attr 
will set the attribute even when it's absent, this is not wanted.

--

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-24 Thread Berker Peksag

Berker Peksag added the comment:

It would be better to use support.swap_attr().

--
nosy: +berker.peksag
priority: normal -> low
stage: needs patch -> patch review
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-24 Thread Xiang Zhang

Xiang Zhang added the comment:

Ping. :)

--

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-14 Thread Xiang Zhang

Xiang Zhang added the comment:

I write a patch for this trivial fix along with a corresponding test. Hope it 
helps. :)

--
keywords: +patch
Added file: http://bugs.python.org/file44112/issue27414.patch

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-14 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-08-09 Thread Martin Panter

Changes by Martin Panter :


--
stage:  -> needs patch

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-06-29 Thread R. David Murray

R. David Murray added the comment:

Sorry once again for the infelicitous phrasing.  I meant to say "sorry, what I 
was unclearly asking for was what you were calling that..."  Too bad I don't 
drink coffee or I could blame it on not having had any yet today...

--

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-06-29 Thread R. David Murray

R. David Murray added the comment:

For reference, the changeset that introduced that was ee34cb049a10.  An 
interesting feature of that changset is the trace command in the test...I guess 
the wrong patch was comitted and no one noticed.  The trace was obvious fixed 
but no one appears to have noticed the int problem, presumably because it gets 
converted to string before being emitted.

Would you be interested in trying to write a test that will detect this, to go 
along with the trivial fix?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-06-29 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +ezio.melotti, pitrou, rhettinger

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-06-29 Thread Mathieu Xhonneux

Mathieu Xhonneux added the comment:

It's line 469 in the latest Lib/http/server.py (and not 473).

--

___
Python tracker 

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



[issue27414] http.server.BaseHTTPRequestHandler inconsistence with Content-Length value

2016-06-29 Thread Mathieu Xhonneux

New submission from Mathieu Xhonneux:

With Python 3.5, when I subclass SimpleHTTPRequestHandler, which itself 
subclasses BaseHTTPRequestHandler, and I try to access a non-existing file, the 
server responds with a 404 code, but send_error (see Lib/http/server.py, line 
473) adds the Content-Length header with an int value, whereas all others 
functions convert this value to str (see lines 699, 761).

For consistency, all header values should be str.

--
components: Library (Lib)
messages: 269488
nosy: m.xhonneux
priority: normal
severity: normal
status: open
title: http.server.BaseHTTPRequestHandler inconsistence with Content-Length 
value
type: enhancement
versions: Python 3.5

___
Python tracker 

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