From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,8a39a73d0242ca42 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.skynet.be!aioe.org!nospam From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: GNAT.Sockets. Blocking? Date: Wed, 24 Jun 2009 10:36:58 -0400 Organization: The Wasteland Message-ID: References: <158756da-21b7-4e2d-b288-7ba030f1f35c@25g2000yqb.googlegroups.com> <392f68f1-4eb3-473d-ab9a-d3d8ff524ff3@c9g2000yqm.googlegroups.com> NNTP-Posting-Host: ib4TTflHUauJidfWP/+Rjw.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.7.9 Cancel-Lock: sha1:1QsW/kBCbcjIWWV/55WsjgZ095c= User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news2.google.com comp.lang.ada:6597 Date: 2009-06-24T10:36:58-04:00 List-Id: In article <392f68f1-4eb3-473d-ab9a-d3d8ff524ff3@c9g2000yqm.googlegroups.com>, "Jacob M. H. Smith" wrote: > On Jun 24, 2:14 am, "John B. Matthews" wrote: > > The Google page specifies "Transfer-Encoding: chunked", which must be > > "terminated by closing the connection." To get the whole page, I think   > > you'd need to handle the chunk-size: > > > > > > Thanks for your reply, but I don't think that's correct. It says > "the set of transfer-codings MUST include "chunked", unless the > message is terminated by closing the connection.". That sounds > to me like there is really no problem in having a persistent > connection and chunked transfer encoding. Right, but you still have to read the headers, one CRLF-delimited line at a time. Then you can read the chunk-size line and chunk-data in a loop until the chunk-size is zero. I don't know any way to read lines except one octet at a time, as Dmitry suggests: > > Your code gets www.example.com correctly, without an explicit > > "Connection: close": > > > > > > I think that's because example.com closes the connection, no matter > if you request a persistent connection or not. At least on my end > here. I see what you mean; example.com sends the "Connection: close" header, which signifies no persistent connection to the client: ... Content-Length: 438 Connection: close Content-Type: text/html; charset=UTF-8 ... netstat -a | grep http tcp4 0 0 10.20.30.40.53386 www.example.com.http LAST_ACK Otherwise, persistent connections appear to be the default in HTTP 1.1: -- John B. Matthews trashgod at gmail dot com