[ee122] question about persistent connection

Daniel Killebrew dank at eecs.berkeley.edu
Sat Oct 27 13:09:52 PDT 2007


I'm confused what you're trying to ask here.

The server will close the connection if it doesn't support persistent 
connections.


Davide Cerri wrote:
> Hello,
>   
>> Actually, if the server does not include a content length or chunked
>> header line, the client should assume that the server will send the file
>> and close the connection after sending the last byte of the file. So the
>> client will take everything after the HTTP header and save it as the file.
>>     
>
> I have a problem understanding how can we use the headers for chunking
> and content length to tell us if a connection is closed. I mean, the
> absence of those headers tell us we won't have a persistent connection
> if we are sent a file. 
> But what if we ask a persistent connection and
> we request a file that is invalid. The server will politely reply
>
> "HTTP/1.0 404 Not Found: /spam/is-tasty.html"
>
> and no header will be sent to the client.
The response indicates that there will be no file. If the server closes 
the connection after sending the response, obviously it doesn't support 
persistent connections. A blank line always follows the last header line.
>  Now is the connection
> persistent or not? Because if i base my decision on the lack of
> headers, that would imply that the server would close the connection
> every time a client ask for an invalid file.
> Wouldn't make sense for the server to always add a header to notify
> the client that the connection is being kept alive?
>   
Closing the connection notifies the client that the connection is not 
being kept alive...
> can somebody explain persistent connection more precisely?
>   
The point was this:
If a connection is persistent, the client needs to know where the end of 
a file is, and the beginning of the next response. So there must either 
be content-length or chunking to provide framing.
If it's not persistent then the client can assume that the connection 
will be closed after the last byte of the file is sent.

Daniel
> thanks
> Davide Cerri
>
>
>
>
>
>
>
>
>   
>> Important change to what I said earlier, read on:
>>
>> Daniel Killebrew wrote:
>>     
>>> A persistent connection has nothing to do with the reply coming in
>>> chunked or not. Persistent connection means the server won't close the
>>> connection after the file is sent.
>>>
>>> But if you don't get a content length or chunked header line, you're
>>> free to gracefully close the connection and indicate the error to the user.
>>>
>>>       
>> Actually, if the server does not include a content length or chunked
>> header line, the client should assume that the server will send the file
>> and close the connection after sending the last byte of the file. So the
>> client will take everything after the HTTP header and save it as the file.
>>
>> Professor Paxson pointed out:
>> The reasoning behind this is, if the client says it wants a persistent
>> connection,
>> the server can *decline*. In that case, it can return an item with no
>> content-length and no chunking and it's not an error, so the client in
>> that case shouldn't close the connection when it sees the absence of either
>> of those headers; it should read the item up to an end-of-file.
>>
>> Daniel
>>     
>
>   


More information about the ee122 mailing list