Rui Carmo rca...@gmail.com added the comment:
I'd like to add that when supplying custom headers for things like UPNP (which
uses SOAPACTION as a header to talk to frequently very limited servers), the
library shouldn't mangle the headers in any way whatsoever and send them
verbatim.
(I
R. David Murray rdmur...@bitdance.com added the comment:
No idea if this is even still valid (I skimmed the issue, I did not try to
understand it in detail), but I agree that a change like this is more feature
than bug fix, so I'm updating the issue settings accordingly.
--
nosy:
Senthil Kumaran orsent...@gmail.com added the comment:
I think, we need to move forward with this. It is one of the earliest i worked
on. I shall look at John's patch and look through it's inclusion in the code.
--
assignee: facundobatista - orsenthil
John J Lee [EMAIL PROTECTED] added the comment:
I have attached a patch that just:
* Improves doctests a bit
* Changes .get_headers() and .has_header() to be case-insensitive
* Documents .get_header() and .header_items(), fixes some
incorrectly-documented argument names, and notes the
Changes by John J Lee [EMAIL PROTECTED]:
Added file: http://bugs.python.org/file11887/issue2775-problems.patch
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
John J Lee [EMAIL PROTECTED] added the comment:
The CaseInsensitive dict class fails to preserve its invariants (implied
invariants, since there are no tests for it). There are also problems
with the documentation in the patch. I will submit a modified patch, I
hope later this week.
John J Lee [EMAIL PROTECTED] added the comment:
By the way, this is a feature addition, not a bug fix. The first beta
releases for 2.6 and 3.0 came out some time ago, so according to PEP
361, this change should not be committed to trunk until after the 2.6 /
3.0 maintenance branches have been
Senthil [EMAIL PROTECTED] added the comment:
Facundo, Shall we go ahead with committing these changes?
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
Facundo Batista [EMAIL PROTECTED] added the comment:
I'm ok with these patchs, Senthil.
John, what do you think about this?
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
Changes by Senthil [EMAIL PROTECTED]:
Added file: http://bugs.python.org/file11024/issue2275-py3k.diff
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
Senthil [EMAIL PROTECTED] added the comment:
I am submitting a revised patch for this issue.
I did some analysis on the history of this issue and found that this
.capitalize() vs .title() changes had come up earlier too (
issue1542948)and decision was taken to:
- To retain the Header format in
Changes by Senthil [EMAIL PROTECTED]:
Removed file: http://bugs.python.org/file10862/issue2275-py26.diff
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
Changes by Senthil [EMAIL PROTECTED]:
Removed file: http://bugs.python.org/file10863/issue2275-py3k.diff
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
Changes by Senthil [EMAIL PROTECTED]:
Added file: http://bugs.python.org/file11023/issue2275-py26.diff
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
John J Lee [EMAIL PROTECTED] added the comment:
With respect to point 1), I assume that we all agree upon that headers
should stored in Titled-Format instead of Capitalized-format.
I would probably choose to store the headers in Capitalized-form,
because that makes implementing .headers
John J Lee [EMAIL PROTECTED] added the comment:
Of course, that along the lines of suggestion isn't quite right: None
does not have a .title() method.
(and, to spell it out, I'm assuming in that suggestion that .headers is
the dict of headers with .capitalize()d keys, i.e. unchanged from Python
Senthil [EMAIL PROTECTED] added the comment:
Sorry for the delay and my miss in further communication on this issue.
I would like to take this issue in two fronts for its closure.
1) Issue with headers .capitalize() vs .title()
2) Documenting the Interface
With respect to point 1), I assume
Hans-Peter Jansen [EMAIL PROTECTED] added the comment:
Facundo, first of all: *really* nice work, thanks a lot.
While I don't fully understand the issues raised lately here,
especially what broke (user code). I can see, that it completely
solves my original problem, which is great.
While
John J Lee [EMAIL PROTECTED] added the comment:
There already is a test for the breakage, but the patch changes the
expected output to match the new return value of .header_items():
-[('Foo-bar', 'baz'), ('Spam-eggs', 'blah')]
+[('Foo-Bar', 'baz'), ('Spam-Eggs', 'blah')]
Code that
John J Lee [EMAIL PROTECTED] added the comment:
* The patch to the docs seems to muddy the waters even further (than the
current slightly murky state) about whether and why .headers is to be
preferred over the methods, or vice-versa. I think .headers should
remain undocumented, for the
John J Lee [EMAIL PROTECTED] added the comment:
Just to quickly note that by providing case-insensitive lookup I don't
necessarily mean via .headers. But it's you who's providing the patch,
so I'll wait for your next suggestion rather than discuss how I might
change the code.
John J Lee [EMAIL PROTECTED] added the comment:
* The patch looks like it will break code that uses .header_items(),
which is not acceptable.
* The patch to the docs seems to muddy the waters even further (than the
current slightly murky state) about whether and why .headers is to be
preferred
Facundo Batista [EMAIL PROTECTED] added the comment:
John:
You say that it will break code because it changes the capitalization
policy, or because other reason? Do you think that there's a way to fix
this issue and not break the code?
If you really think that this breaks code, please provide
Senthil [EMAIL PROTECTED] added the comment:
John J Lee [EMAIL PROTECTED] added the comment:
* The patch looks like it will break code that uses .header_items(),
which is not acceptable.
Nope, it does not break. If the concern was subclassing dict may have adverse
effect on .copy and
Facundo Batista [EMAIL PROTECTED] added the comment:
Senthil: patch is fine.
Remember to provide not only a modification for docs, but also to the
Misc/NEWS file.
Thank you!!
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
Changes by Senthil [EMAIL PROTECTED]:
Removed file: http://bugs.python.org/file10849/issue2275-py26.diff
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
Senthil [EMAIL PROTECTED] added the comment:
Here is the final patch for Py26 and Py3k including the Docs and Misc/News.
Thanks you,
Senthil
Added file: http://bugs.python.org/file10862/issue2275-py26.diff
___
Python tracker [EMAIL PROTECTED]
Changes by Senthil [EMAIL PROTECTED]:
--
versions: -Python 2.5
Added file: http://bugs.python.org/file10863/issue2275-py3k.diff
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
Senthil [EMAIL PROTECTED] added the comment:
I also removed the Python 2.5 from the Version, as I don't think these
changes will be back ported.
After the application of patch, this issue can be closed.
___
Python tracker [EMAIL PROTECTED]
Senthil [EMAIL PROTECTED] added the comment:
Please have a look at this patch.
- Included a CaseInsensitiveDict Lookup for Headers interface.
- Headers will now be .title()-ed instead of .capitalized() ed.
- Included Tests for the changes made.
In the test_urllib2, I have not removed this line
Facundo Batista [EMAIL PROTECTED] added the comment:
Senthil: We would need some tests to assure this will keep working ok in
the future
Also as this is (somehow) a new functionality, we'd need to modify the
NEWS file and maybe even the docs (a comment about this case insensitivity?
Could you
Changes by Senthil [EMAIL PROTECTED]:
Removed file: http://bugs.python.org/file9907/issue2275.patch
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
___
___
Senthil [EMAIL PROTECTED] added the comment:
Issue applicable to Py2.6 and Py3K. Previous patch attached was wrong.
Removed it.
--
versions: +Python 2.6, Python 3.0
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
Martin McNickle [EMAIL PROTECTED] added the comment:
This looks good. I would suggest that the unredirected_hdrs would use
the CaseInsensitiveDict too.
There is still the problem (from the test documentation) that accessing
.headers directly will only show a subset of headers i.e. it won't
Hans-Peter Jansen [EMAIL PROTECTED] added the comment:
But should not this patch be handled in a way wherein.
key.capitalize() is just replaced by key.upper()?
Hmm, are you sure?
hello.upper()
'HELLO'
but the issue is with values containing dashes:
'accept-charset'.capitalize()
John J Lee [EMAIL PROTECTED] added the comment:
Specifically, these improvements could be made:
* the headers actually sent to httplib could be normalized to
Standard-Http-Case by urllib2
* the urllib2.Request.headers interface could support case-insensitive
key lookup
John J Lee [EMAIL PROTECTED] added the comment:
urllib2.Request.headers is, in practice, an undocumented public
interface. Did you run the tests? There is room for improvement here,
but not in the way you suggest.
python[1]$ python2.6
iPython 2.6a1+ (trunk:62045M, Mar 30 2008, 03:07:23)
[GCC
Senthil [EMAIL PROTECTED] added the comment:
Hi John, Greetings!
I agree with both of your suggestions.
Attached is the patch which aims to implement both in one go.
Please provide your comments on that.
If this method is okay, I shall go ahead with patches for tests and
attach it also.
Thanks,
Changes by Senthil [EMAIL PROTECTED]:
Removed file: http://bugs.python.org/file9906/issue2275.patch
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
__
___
Python-bugs-list
Changes by Senthil [EMAIL PROTECTED]:
Added file: http://bugs.python.org/file9907/issue2275.patch
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
__
___
Python-bugs-list
Hans-Peter Jansen [EMAIL PROTECTED] added the comment:
Hi Senthil,
that looks promising, and the title() trick is nice, as it fixes my
issue..
Thanks,
Pete
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2275
__
Senthil [EMAIL PROTECTED] added the comment:
I understand your implementation of _cap_header_key function.
But should not this patch be handled in a way wherein.
key.capitalize() is just replaced by key.upper()?
Should not that suffice?
What is the difference between _cap_header_key and
New submission from Hans-Peter Jansen [EMAIL PROTECTED]:
The urllib2 behavior related to headers is - hmm - improvable.
It simply capitalize() the key, which leads to funny results like:
Accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
while this is seemingly conforming to the specs, it's simply
43 matches
Mail list logo