Initial import of public WANProxy codebase.

Based on r238 in the Marvelous Proof repository.


git-svn-id: http://wanproxy.org/svn/trunk@1 4068ffdb-0463-0410-8185-8cc71e3bd399
Nuke the history file.  This may not be a great idea, but I think that now that
Subversion is available publically it's pretty redundant.


git-svn-id: http://wanproxy.org/svn/trunk@2 4068ffdb-0463-0410-8185-8cc71e3bd399
Comment BufferSegment functions and add a missing check in
BufferSegment::prefix().


git-svn-id: http://wanproxy.org/svn/trunk@3 4068ffdb-0463-0410-8185-8cc71e3bd399
o) Add a parameter to Channel::read to take an amount to read, defaulting to 0,
   which retains the old behavior of reading whatever amount is available.
o) Implement new Channel::read semantics in FileDescriptor::read.  Add buffering
   to FileDescriptor.
   Note that this tries to only read the amount specified by the caller, which
   may not be most efficient, but may provide the right behavior in terms of
   not acknowledging data?
o) Add ugly hackish redundant APIs to support numeric IP addresses in addition
   to strings.
o) Use said ugly hackish API to implement a simple SOCKS4 proxy.  It's a very
   conservative proxy that tries to be discreet (in that it doesn't send errors
   to clients sending random requests.)
   XXX SOCKS5 would be nice.
o) Modify the default config to show chaining through to the SOCKS4 proxy.


git-svn-id: http://wanproxy.org/svn/trunk@4 4068ffdb-0463-0410-8185-8cc71e3bd399
Update TODO to reflect things that came up working on the SOCKS4 mode.


git-svn-id: http://wanproxy.org/svn/trunk@5 4068ffdb-0463-0410-8185-8cc71e3bd399
Do as the XXX suggests and avoid starting the local peer until the remote peer
is connected.  Otherwise we would blow up when close_peer() is called while we
are still connecting to the remote peer.  Now, maybe the right thing to do is to
fix that case to work properly so we can buffer lots of data from a client that
is starting out with a lot of data, but really that's an uncommon case so for
now do the easy thing.


git-svn-id: http://wanproxy.org/svn/trunk@6 4068ffdb-0463-0410-8185-8cc71e3bd399
Change priority of some INFO messages to DEBUG.


git-svn-id: http://wanproxy.org/svn/trunk@7 4068ffdb-0463-0410-8185-8cc71e3bd399
o) Temporarily make XCodecDecocer::decode return a boolean, false if there's a
   fatal error.  (Namely, that a hash could not be resolved, in which case we
   reset the connection.)
o) Reset the connection if decode fails, per above.


git-svn-id: http://wanproxy.org/svn/trunk@8 4068ffdb-0463-0410-8185-8cc71e3bd399
As in the case of a missing hash, give a failure for duplicate hash.


git-svn-id: http://wanproxy.org/svn/trunk@9 4068ffdb-0463-0410-8185-8cc71e3bd399
Fix accidental boolean inversion.


git-svn-id: http://wanproxy.org/svn/trunk@10 4068ffdb-0463-0410-8185-8cc71e3bd399
Lazily SOCKS5 support.


git-svn-id: http://wanproxy.org/svn/trunk@11 4068ffdb-0463-0410-8185-8cc71e3bd399
State my resounding confidence in the proxy code.


git-svn-id: http://wanproxy.org/svn/trunk@12 4068ffdb-0463-0410-8185-8cc71e3bd399
Start work on a ProxyPipe class, not hooked up to anything, to replace the ugly
hack that is ProxyPeer.  ProxyClient will instead work in terms of a pair of
pipes, I believe.


git-svn-id: http://wanproxy.org/svn/trunk@13 4068ffdb-0463-0410-8185-8cc71e3bd399
o) If an accept fails in one of the listeners, we should keep trying to accept.
   XXX Maybe we need to check the errno.
o) Switch to the new ProxyPipe code and rewrite the ProxyClient for it.
o) Update TODO to mention a race that could lead to SIGPIPE.


git-svn-id: http://wanproxy.org/svn/trunk@14 4068ffdb-0463-0410-8185-8cc71e3bd399
Disable SIGPIPE to work around a deficiency in ProxyPipe/ProxyClient.


git-svn-id: http://wanproxy.org/svn/trunk@15 4068ffdb-0463-0410-8185-8cc71e3bd399
o) Add some more assertions to ProxyPipe around errors and cancelling.
o) When ProxyClient cancels us before we've told it we're done or there's an
   error we must cancel any outstanding actions.


git-svn-id: http://wanproxy.org/svn/trunk@16 4068ffdb-0463-0410-8185-8cc71e3bd399
Pass errno when accept fails.


git-svn-id: http://wanproxy.org/svn/trunk@17 4068ffdb-0463-0410-8185-8cc71e3bd399
Add a drain function to ProxyPipe that tells it there will be no more data
inbound for it and that it should finish writing its data and then disappear.

Call this from ProxyClient whenever we get flow_complete and there is an
active pipe.


git-svn-id: http://wanproxy.org/svn/trunk@18 4068ffdb-0463-0410-8185-8cc71e3bd399
When drain() is called, return immediately if we're already performing a
callback to tell ProxyClient why we'd like to disappear.


git-svn-id: http://wanproxy.org/svn/trunk@19 4068ffdb-0463-0410-8185-8cc71e3bd399
Bump copyright.


git-svn-id: http://wanproxy.org/svn/trunk@20 4068ffdb-0463-0410-8185-8cc71e3bd399