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

Re: apt-get and socks



On 6 Mar 2000, Rainer Weikusat wrote:

> > I rather like connect.cc the way it is and would rather people fixed
> > the socksification libs to support that.
 
> This cannot possibly be fixed in the socksification libraries, it's a
> problem with circuit level proxying and the Posix API as such.

It can, they just have to be more extreme in what they hook. To do this
properly the socksification lib would have to act as follows..
  1) On nonblcking connect start a non-blocking connection to the socks
     server, return immediately
  2) When select is called on that FD do the following in the select
     call:
       a) wait for non-blocking connect of the FD to complete to the socks
          server.
       b) send connection credentials and final destination (non blocking
          of course)
       c) wait for the success response from the server, then return
          socket readable
All of the above should be done under the umbrella of the given
timeout being carefull not to exceed the total time limit, and continue to
service other FD's that may be ready.

With carefully coding of the select wrapper this can be made very low over
head (in the general case) and allow generalized use of non-blocking
connections with the socksification library.

Of course this is alot more work than what they currently do for connect,
but it is the best solution.

Alternatively, I would suggest that if the socksification library cannot
handle the above correct behavoir it should *NOT* do a non-blocking
connect. It's connect should ignore the non-blocking flag and do a normal
sync connection. Select will naturally return write-ready on any fully
opened socket. The only other thing to ensure is that getsockopt(SO_ERROR)
returns any necessary error codes.

If you ask me the socks library is clearly buggy for not properly
handling the non-blocking case and should be fixed, APT will then work
reasonably with it. Both solutions above are entirely reasonable IMHO,
with the latter being a poorer implemenation.

I suggest you expend your efforts imporving dante rather than abusing APT.

Jason


Reply to: