[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QNetworkReply.header(QNetworkRequest.ContentLengthHeader) returns None
From:       redstone-cold <redstone-cold () 163 ! com>
Date:       2016-05-19 16:20:05
Message-ID: 13435748.201.154c9d11ebe.Coremail.redstone-cold () 163 ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]

I am not sure if this is a bug with the server or PyQt/Qt, but when I use Python \
urllib to make a same request , I get the correct  Content-Length








ÔÚ2016Äê05Ô 18 14ʱ07·Ö, "Florian Bruhin"<me@the-compiler.org>дµÀ:

* redstone-cold <redstone-cold@163.com> [2016-05-18 13:35:55 +0800]:
> reply is type of QNetworkReply,
> QByteArray(b'Content-Length'), PyQt5.QtCore.QByteArray(b'0, 33259656')
> is  the Content-Length pair returned by reply.rawHeaderPairs(), in such case,
> reply.header(QNetworkRequest.ContentLengthHeader) just returns None,
> I wonder is this a bug or not?

Looking at RFC 2616 (the HTTP specification):
https://tools.ietf.org/html/rfc2616#section-14.13

    [...]

      Content-Length = "Content-Length" ":" 1*DIGIT

   An example is

      Content-Length: 3495

and:

   DIGIT = <any US-ASCII digit "0".."9">

The thing you're showing above (b'0, 33259656') thus is an invalid
value, so Qt is probably refusing to parse it.

In other words, whatever is sending that header is buggy.

Florian

--
http://www.the-compiler.org | me@the-compiler.org (Mail/XMPP)
  GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
        I love long mails! | http://email.is-not-s.ms/


[Attachment #5 (text/html)]

<div style="color:#000; font-size: 14px;font-family: arial;"><div><div \
style="line-height: 23.8px;">I am not sure if this is a bug with the server or \
PyQt/Qt, but when I use Python urllib to make a same request , I get&nbsp;the \
correct&nbsp;<span style="line-height: 23.8px;">&nbsp;</span><span \
style="line-height: 23.8px;">Content-Length</span></div></div><div><span \
style="line-height: 23.8px;"><br></span></div><div><br></div><div><br></div><div><br></div></div><!-- \
jy5ContentSuffix --><div>ÔÚ2016Äê05Ô 18 14ʱ07·Ö, "Florian \
Bruhin"&lt;me@the-compiler.org&gt;дµÀ:</div><blockquote id="isReplyContent" \
style="padding-left:1ex; margin: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px \
solid"><br>* redstone-cold &lt;<a \
href="mailto:redstone-cold@163.com">redstone-cold@163.com</a>&gt; [2016-05-18 \
13:35:55 +0800]:<br>&gt; reply is type of QNetworkReply, <br>&gt; \
QByteArray(b'Content-Length'), PyQt5.QtCore.QByteArray(b'0, 33259656')<br>&gt; is \
&nbsp;the Content-Length pair returned by reply.rawHeaderPairs(), in such \
case,<br>&gt; reply.header(QNetworkRequest.ContentLengthHeader) just returns \
None,<br>&gt; I wonder is this a bug or not?<br><br>Looking at RFC 2616 (the HTTP \
specification):<br>https://tools.ietf.org/html/rfc2616#section-14.13<br><br>&nbsp; \
&nbsp; [...]<br><br> &nbsp; &nbsp; &nbsp; Content-Length = "Content-Length" ":" \
1*DIGIT<br><br> &nbsp; &nbsp;An example is<br><br> &nbsp; &nbsp; &nbsp; \
Content-Length: 3495<br><br>and:<br><br> &nbsp; &nbsp;DIGIT = &lt;any US-ASCII digit \
"0".."9"&gt;<br><br>The thing you're showing above (b'0, 33259656') thus is an \
invalid<br>value, so Qt is probably refusing to parse it.<br><br>In other words, \
whatever is sending that header is buggy.<br><br>Florian<br><br>-- \
<br>http://www.the-compiler.org | <a \
href="mailto:me@the-compiler.org">me@the-compiler.org</a> (Mail/XMPP)<br> &nbsp; GPG: \
916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc<br> &nbsp; &nbsp; &nbsp; \
&nbsp; I love long mails! | http://email.is-not-s.ms/<br></blockquote><br><br><span \
title="neteasefooter"><p>&nbsp;</p></span>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic