On Thu, 16 Apr 1998, Goetz Babin-Ebell wrote:
> reading bio.h I found the defines BIO_set_proxies(), BIO_set_proxy_cb(),...
> 
> But I wasn't able to find the code.

Unfortunatly they have been written during my day job and so are not publicaly
available at this point in time.  I have a script that removes most of the
evidence prior to a public release :-).

> Are they implemented and do they handle connections with a proxy ?

Basically you
        bio=BIO_new(BIO_f_proxy_server());
        BIO_set_proxies(f_bio,pxy_ctx);

where pxy_ctx is
        PROXY_CTX *pxy_ctx

        if ((pxy_ctx=PROXY_new()) == NULL) goto end;
        if (!PROXY_add_server(pxy_ctx,"http",proxy)) goto end;
        if (!PROXY_add_server(pxy_ctx,"https",proxy)) goto end;
        if (no_proxy_list != NULL)
             if (!PROXY_add_noproxy(pxy_ctx,no_proxy_list)) goto end;
where proxy could be 'localhost:80'
and no_proxy_list could be 'localhost:pandora'
It looks quite similar to the netscape proxy table ;-).

I can even read from a config file something of the form
---
[ proxies ]
http            = play.mincom.oz.au:80
#https          = play.mincom.oz.au:80
https           = 192.55.1.18:9999
ftp             = play.mincom.oz.au:80
ftp.noproxy     = psy.uq.oz.au more1
noproxy = womble play localhost
---
Anyway you then
        BIO_set_url(b,url);  which sets up a connect BIO to either direct
connect, or to do the proxy protocol with and outer proxy or do a CONNECT. 
The proxy protocol is done if required and it can all work via non-blocking
IO. 

I also do a server side ofthe proxy protocol.  Once a connection is accepted,
(via an accept BIO :-), the server proxy does the handshake and then
makes available the headers etc.

Anyway there is about 2000 lines of code and I find it useful, but
unfortunatly so does my employer :-).

It is a good example of how flexable the BIO concept is though, since programs
with this stuff in them run in non-blocking mode, with the state machines and
it all works.

At the worst case, I end up with
clinet proxy bio
ssl bio
connect bio

All of which have state engines :-).  Now lets mulitplex 10 non-blocking
connections of this form and you get and interesting mess to follow ;-).

Oneday I may end up doing SOCKS via a BIO, which will probably be done in a
very similar manner.  Push on and forget :-).

eric

+-------------------------------------------------------------------------+
| Administrative requests should be sent to [EMAIL PROTECTED] |
| List service provided by Open Software Associates, http://www.osa.com/  |
+-------------------------------------------------------------------------+

Reply via email to