[issue12455] urllib2 forces title() on header names, breaking some requests

Cal Leeming report at bugs.python.org
Fri Jul 1 15:21:38 CEST 2011


Cal Leeming <cal.leeming at simplicitymedialtd.co.uk> added the comment:

Thats full understandable that the default won't change. I'll put this in my
todo list to write a patch in a week or two.
On 1 Jul 2011 08:45, "R. David Murray" <report at bugs.python.org> wrote:
>
> R. David Murray <rdmurray at bitdance.com> added the comment:
>
> Quoting http://tools.ietf.org/html/rfc2068#section-4.2:
>
> Field names are case-insensitive.
>
> Which is only logical, since they are modeled on email headers, and email
header names are case insensitive. So, the server in question is broken,
yes, but that doesn't mean we can't provide a facility to allow Python to
inter-operate with it. Email, for example, preserves the case of the field
names it parses or receives from the application program, but otherwise
treats them case-insensitively. However, since the current code coerces to
title case, we have to provide this feature as a switchable facility
defaulting to the current behavior, for backward compatibility reasons.
>
> And someone needs to write a patch....
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue12455>
> _______________________________________

----------
nosy: +sleepycal
Added file: http://bugs.python.org/file22537/unnamed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12455>
_______________________________________
-------------- next part --------------
<p>Thats full understandable that the default won&#39;t change. I&#39;ll put this in my todo list to write a patch in a week or two.</p>
<div class="gmail_quote">On 1 Jul 2011 08:45, &quot;R. David Murray&quot; &lt;<a href="mailto:report at bugs.python.org">report at bugs.python.org</a>&gt; wrote:<br type="attribution">&gt; <br>&gt; R. David Murray &lt;<a href="mailto:rdmurray at bitdance.com">rdmurray at bitdance.com</a>&gt; added the comment:<br>
&gt; <br>&gt; Quoting <a href="http://tools.ietf.org/html/rfc2068#section-4.2">http://tools.ietf.org/html/rfc2068#section-4.2</a>:<br>&gt; <br>&gt;   Field names are case-insensitive.<br>&gt; <br>&gt; Which is only logical, since they are modeled on email headers, and email header names are case insensitive.  So, the server in question is broken, yes, but that doesn&#39;t mean we can&#39;t provide a facility to allow Python to inter-operate with it.  Email, for example, preserves the case of the field names it parses or receives from the application program, but otherwise treats them case-insensitively.  However, since the current code coerces to title case, we have to provide this feature as a switchable facility defaulting to the current behavior, for backward compatibility reasons.<br>
&gt; <br>&gt; And someone needs to write a patch....<br>&gt; <br>&gt; ----------<br>&gt; <br>&gt; _______________________________________<br>&gt; Python tracker &lt;<a href="mailto:report at bugs.python.org">report at bugs.python.org</a>&gt;<br>
&gt; &lt;<a href="http://bugs.python.org/issue12455">http://bugs.python.org/issue12455</a>&gt;<br>&gt; _______________________________________<br></div>


More information about the Python-bugs-list mailing list