Well There is a solution to all *THIS*

and Ted Ts'o did it!  Bill sent me Ted's patch and with a bit of
hacking I made it work here.

Ted's patch was to add a function to the libwww2/HTAccess.c file
url_translate()  which takes the URL and compares it to a list of
mappings (~/.url_translations file)

------------- url_translations -----------------
http://www.coe.uncc.edu/(.*)    file://localhost/afs/uncc.edu/mosaic_web/\1
http://www.coe.uncc.edu/uncc_web/(.*)   file://localhost/afs/uncc.edu/uncc_web/\1
http://www.mit.edu:8001/people/(.)(.)(.*)       
file://localhost/afs/athena.mit.edu/user/\1/\2/\1\2\3

------------------------------- end of file ------------------

The function mungs the URL (if needed/matched) and that does the trick.

Notice that you could specify "remote" AFS sites (www.mit.edu) - but this
assumes that you will have the site mounted to your local site.

Ted's code relies on regex.c & regex.h from GNU - I got it out of my
emacs source (REGEXP POSIX version) SunOS doesn't have it so a little searching
and then I needed to edit regex.c and add #define REGEX_MALLOC - so it
would use malloc instead of alloc (which is undefined on SunOS).

Ted also included a main() in the url_translation.c code so I had to add:

#ifdef DEBUG            /* dak WWW_TraceFlag is extern in HTUtil.h */
int WWW_TraceFlag;
#endif

and delete a few #if 0 (Bill added) so that I could compile a exec - url_mung
(I named it that) set up your ~/.url_translate file then pass it a test case:

% url_mung http://www.coe.uncc.edu/home.html
file://localhost/afs/uncc.edu/mosaic_web/home.html

and it returns the AFS version...

add to the libwww2/Makefile - the url_translation.c & regex.c and compile
Mosaic ... I got it working in a few hours.... in between typing mail
messages to all you folks...

THANKS to BILL & TED - UNCC will now have a client that is AFS aware...
well at least it will use the local file system instead of hitting the
httpd server for all the local files.  Look at your transfer logs...
that should be a lot of hits... 

If anyone wants the hacks - Ted copyrighted them via:
 * Copyright 1994, Theodore Ts'o.  This file may be redistributed
 * under the terms of the GNU Public License.  If these terms don't
 * meet with your satisfaction, contact me at <[EMAIL PROTECTED]>
I'm not sure if I can re-distribute a changed version but my

http://www.coe.uncc.edu/~dak/Mosaic_AFS_aware.html

I hope he won't mind (if you do let me know).

NOW THE PROBLEM !!!!!!!!!!!!!

The url_translate() mungs a URL like:

http://www.coe.uncc.edu/~dak

It doesn't know how to resolve the ~dak - it should go to the
~dak/public_html dir.  Oh-well back to the drawing board.  I
assume the answer will be - add a bit of the original WWW code 
into the url_translate() code...


David Koontz                                    ([EMAIL PROTECTED])
Project Mosaic Consultant                       (704) 547-4894
College of Engineering                          Smith 220
University of North Carolina at Charlotte       Charlotte, NC  28223

Reply via email to