libWWW 2.14 diffs for proxy support

Kevin Altis (altis@ibeam.jf.intel.com)
Fri, 11 Feb 1994 08:46:52 --100


Below is the message Lou Montulli put together to describe the proxy
support for Lynx 2-2. These changes were rolled into the various flavors of
Mosaic (X Mosaic 2.2 has already been released) and libWWW 2.15 which the
CERN folks (Ari and TimBL) are currently working on. Clients based on
libWWW should be able to utilize the changes described below in order to
support a proxy gateway. I'm currently working on actual HTTP transaction
examples to further describe the proxy service.

The main thing to understand about the proxy gateway is that instead of a
partial URL being sent to the HTTP server, which is what we do today when a
client talks directly to an HTTP server, a client must send a full URL
(http://..., gopher://..., ftp://...) to the proxy gateway server, the rest
of the HTTP message is the same. For gopher and ftp, the proxy gateway
server will return the data encapsulated as a MIME content type to the
client like a normal HTTP message. HTTP MIME content types are returned for
all URL requests, regardless of the protocol type of the URL. FTP
directories, Gopher directories, etc. are returned as text/html.

ka

---

From: montulli@stat1.cc.ukans.edu (Lou Montulli) Subject: Re: Firewall gateway solution, exodus Date: Tue, 1 Feb 94 19:05:06 CST

Per our earlier discussions about using <protocal>_proxy as the environment variables I have some new diffs:

This solution will only work with HTTP gateways. These diffs apply to libWWW 2.14

falcon.cc.ukans.edu> diff ../WWW2.14/Lib*/I*/HTAccess.c WWW/L*/I*/HTAccess.c 54a55 > PUBLIC BOOL using_proxy = NO; /* are we using a proxy gateway? */ 155c156,158 < char * gateway_parameter, *gateway;

---
>       char * gateway_parameter, *gateway, *proxy;
>
>       /* search for gateways */
161a165,169
>
>       /* search for proxy servers */
>       strcpy(gateway_parameter, access);
>         strcat(gateway_parameter, "_proxy");
>       proxy = (char *)getenv(gateway_parameter);
162a171,175
>
>       if(TRACE && gateway)
>           fprintf(stderr,"Gateway found: %s\n",gateway);
>       if(TRACE && proxy)
>           fprintf(stderr,"proxy server found: %s\n",proxy);
169c182,199
<       if (gateway) {
---
>
>       /* make sure the using_proxy variable is false */
>       using_proxy = NO;
>
>       /* proxy servers have precedence over gateway servers */
>       if(proxy) {
>           char * gatewayed=0;
>             StrAllocCopy(gatewayed,proxy);
>             StrAllocCat(gatewayed,addr);
>             using_proxy = YES;
>             HTAnchor_setPhysical(anchor, gatewayed);
>           free(gatewayed);
>           free(access);
>
>           access =  HTParse(HTAnchor_physical(anchor),
>               "http:", PARSE_ACCESS);
>
>       } else if (gateway) {

I replaced the libWWW version of HTTP.c with Xmosaic's version and started changing, so rather than giving diffs I'll just describe the changes. :)

add this to define the global variable: extern BOOL using_proxy; /* are we using an HTTP proxy gateway? */

add this to remove the first character of the resulting path. This is done because the resulting URL of the gateway change in HTAccess causes something like these to appear: gopher://gopher.host/path">http://gateway.host/gopher://gopher.host/path wais://wais.host/path">http://gateway.host/wais://wais.host/path http://gateway.host/http://http.host/path

The protocol and host is stripped by the time we reach the variable p1 below, by the statement: char * p1 = HTParse(arg, "", PARSE_PATH|PARSE_PUNCTUATION); so we end up with: /gopher://gopher.host/path /wais://wais.host/path /http://http.host/path

and we want to send: gopher://gopher.host/path wais://wais.host/path http://http.host/path

/* if we are using a proxy gateway don't copy in the first slash * of say: /gopher://a;lkdjfl;ajdf;lkj/;aldk/adflj * so that just gohper://.... is sent. */ if(using_proxy) strcat(command, p1+1); else strcat(command, p1);

That should do it. Now when a gateway definition is used that gateway should be sent the entire URL of the requested document.

:lou

--
  **************************************************************************
  *           T H E   U N I V E R S I T Y   O F   K A N S A S              *
  *         Lou  MONTULLI @ Ukanaix.cc.ukans.edu                           *
  *                         Kuhub.cc.ukans.edu      ACS Computing Services *
  *     913/864-0436        Ukanvax.bitnet             Lawrence, KS 66044  *
  *             UNIX! Cool! I know that!  Jurassic Park - The Movie        *
  **************************************************************************