[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#64530: apt: The http method does not work correctly for HTTP/1.0 proxies



> You are confused about what the Encoding variable does. It does not
> control how APT handles pipelining, it (as it says) controls how APT
> decodes the data (It is the transfer encoding).

OK, further investigation of the code reveals that there is a Pipeline
variable.

Trying this patch instead:

       if(Major==0 || (Major==1 && Minor==0))
          Pipeline = false;

works as I would expect it to for the second and subsequent requests.
The first request to the server still sends all of the pipeline of
requests.  This still causes an error for this file.

It seems to me that with the pipelining enabled there is a race
condition.  The program thinks that the connection is still open, but
when it goes to read the data from it it has closed.  This causes the
read errors that I see.  I can't find the location in the code that
the decision is made if the connection will contain another set of
data (HTTP/1.1) or if it won't (HTTP/1.0).


I have found a work-around for the apt behaviour, setting
Acquire::http::Pipeline-Depth fixes it.  This stops pipelining and
therefore stops the race condition from happening.  The following two
trials that I performed show this (with the unmodified http program).

-------------------- trial 1 --------------------
g2:~/apt# grep Pipeline /etc/apt/apt.conf
Acquire::http::Pipeline-Depth "10";

g2:~/apt# rm /var/state/apt/lists/www.uk.debian.org_debian_dists_potato_*

g2:~/apt# http_proxy=http://localhost:8080/ apt-get update
Get:1 http://www.uk.debian.org potato/contrib Packages [30.2kB]
Get:2 http://www.uk.debian.org potato/contrib Release [96B]
Err http://www.uk.debian.org potato/contrib Release
  Error reading from server - read (104 Connection reset by peer)
Get:3 http://www.uk.debian.org potato/non-free Packages [73.9kB]
51% [1 potato/contrib gzip 0] [3 potato/non-free 23610/73.9kB 31%]
Err http://www.uk.debian.org potato/non-free Packages             
  Error reading from server - read (104 Connection reset by peer)
28% [1 potato/contrib gzip 35630] [Waiting for file]stdin: unexpected end of file
Err http://www.uk.debian.org potato/contrib Packages
  Sub-process gzip returned an error code (1)
Get:4 http://www.uk.debian.org potato/non-free Release [97B]
Err http://www.uk.debian.org potato/non-free Release
  Error reading from server - read (104 Connection reset by peer)
Get:5 http://www.uk.debian.org potato/non-US/main Packages [14.5kB]
Get:6 http://www.uk.debian.org potato/non-US/main Release [100B]
Get:7 http://www.uk.debian.org potato/non-US/contrib Packages [20B]
Get:8 http://www.uk.debian.org potato/non-US/contrib Release [103B]
Get:9 http://www.uk.debian.org potato/non-US/non-free Packages [6044B]
Get:10 http://www.uk.debian.org potato/non-US/non-free Release [104B]
Get:11 http://www.uk.debian.org potato/main Packages [830kB]
Get:12 http://www.uk.debian.org potato/main Release [93B]
Fetched 881kB in 2s (361kB/s)                            
Failed to fetch http://www.uk.debian.org/debian/dists/potato/contrib/binary-i386/Packages
  Sub-process gzip returned an error code (1)
Failed to fetch http://www.uk.debian.org/debian/dists/potato/contrib/binary-i386/Release
  Error reading from server - read (104 Connection reset by peer)
Failed to fetch http://www.uk.debian.org/debian/dists/potato/non-free/binary-i386/Packages
  Error reading from server - read (104 Connection reset by peer)
Failed to fetch http://www.uk.debian.org/debian/dists/potato/non-free/binary-i386/Release
  Error reading from server - read (104 Connection reset by peer)
-------------------- trial 1 --------------------

-------------------- trial 2 --------------------
g2:~/apt# grep Pipeline /etc/apt/apt.conf
Acquire::http::Pipeline-Depth "0";

g2:~/apt# rm /var/state/apt/lists/www.uk.debian.org_debian_dists_potato_*

g2:~/apt# http_proxy=http://localhost:8080/ apt-get update
Get:1 http://www.uk.debian.org potato/contrib Packages [30.2kB]
Get:2 http://www.uk.debian.org potato/contrib Release [96B]
Get:3 http://www.uk.debian.org potato/non-free Packages [73.9kB]
Get:4 http://www.uk.debian.org potato/non-free Release [97B]
Get:5 http://www.uk.debian.org potato/non-US/main Packages [14.5kB]
Get:6 http://www.uk.debian.org potato/non-US/main Release [100B]
Get:7 http://www.uk.debian.org potato/non-US/contrib Packages [20B]
Get:8 http://www.uk.debian.org potato/non-US/contrib Release [103B]
Get:9 http://www.uk.debian.org potato/non-US/non-free Packages [6044B] 
Get:10 http://www.uk.debian.org potato/non-US/non-free Release [104B]    
Get:11 http://www.uk.debian.org potato/main Packages [830kB]              
Get:12 http://www.uk.debian.org potato/main Release [93B]
Fetched 956kB in 2s (396kB/s)                             
-------------------- trial 2 --------------------

This persuades me that the server is not in error.  How do you explain
this if it is not an apt problem with making assumptions about the
pipelining nature of the server?


-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             amb@gedanken.demon.co.uk
                                      http://www.gedanken.demon.co.uk/



Reply to: