<DIV>
<P>This seems like it has something to do with my problem, although it doesn't offer any clues as to a solution:</P>
<P>"Unfortunately, handling arbitrary data chunks is a hard way to code a server. This is why twisted has many classes sitting in submodules of the twisted.protocols package which give higher level interface to the data. For line oriented protocols, <CODE>LineReceiver</CODE> translates the low-level <CODE>dataReceived</CODE> events into <CODE>lineReceived</CODE> events. However, the first naive implementation of <CODE>LineReceiver</CODE> proved to be too simple. Protocols like HTTP/1.1 or Freenet have packets which begin with header lines that include length information, and then byte streams. <CODE>LineReceiver</CODE> was rewritten to have a simple interface for switching at the protocol layer between line-oriented parts and byte-stream parts. "</P>(from <A href="http://www.python10.org/p10-papers/09/index.htm">http://www.python10.org/p10-papers/09/index.htm</A>)<BR><BR><B><I>Andrea Soong <girloncrack@yahoo.com></I></B> wrote:
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<DIV>Hi all,</DIV>
<DIV> </DIV>
<DIV>First off, I'd like to say thanks to Ken Whitesell for giving me some much needed help.</DIV>
<DIV> </DIV>
<DIV>Here's my problem: I am using an HTTPClient instance to connect to a webpage, and am trying to retrieve its contents and display to the screen line by line, using the lineReceived method. This is all being done in an .rpy file. For some reason, I am only receiving the header information:</DIV>
<DIV>---------------------------------------------</DIV>
<DIV>[start line received]<BR> HTTP/1.0 200 OK<BR>[end line received]<BR>[start line received]<BR> Cache-Control: private<BR>[end line received]<BR>[start line received]<BR> Content-Type: text/html<BR>[end line received]<BR>[start line received]<BR> Set-Cookie: PREF=ID=aacd1eed2e435ca5:TM=1118474192:LM=1118474192:S=QyMnwhj46cXbhy_1; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com<BR>[end line received]<BR>[start line received]<BR> Server: GWS/2.1<BR>[end line received]<BR>[start line received]<BR> Date: Sat, 11 Jun 2005 07:16:32 GMT<BR>[end line received]<BR>[start line received]<BR> Connection: Close<BR>[end line received]<BR>[start line received]<BR> <BR>[end line received]</DIV>
<DIV>---------------------------------------------</DIV>
<DIV> </DIV>
<DIV>Does anyone know if there is some incompatibility in using lineReceived with the format of a webpage (i.e. maybe they are missing the standard EOL delimiters)? dataReceived works fine and outputs the whole webpage at once. </DIV>
<DIV> </DIV>
<DIV>
<DIV>Also, I am using handleRequestEnd to detect the end of the transmission and call request.finish(), but it does not seem to be getting called at all - the browser just keeps waiting for more data. I've put a simple request.write("handleRequestEnd called") call on the first line of the method and it does not get written to the screen. I can't find any explanation for how to use most of the methods in the HTTPClient class in the API - is there a better way to do this (i.e. one that works!) ?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Andrea</DIV></DIV>
<P>
<HR SIZE=1>
Discover Yahoo!<BR>Have fun online with music videos, cool games, IM & more. <A href="http://us.rd.yahoo.com/evt=32660/*http://discover.yahoo.com/online.html">Check it out!</A>_______________________________________________<BR>Twisted-Python mailing list<BR>Twisted-Python@twistedmatrix.com<BR>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python<BR></BLOCKQUOTE></DIV><p>
                <hr size=1>Do you Yahoo!?<br>
Yahoo! Mail - Find what you need with new enhanced search. <a href="http://us.rd.yahoo.com/evt=29917/*http://info.mail.yahoo.com/mail_250">Learn more.</a>