Unfolder 2.0 source
Hi all,
I'm sorry if some of you got this message twice.
I'm one of the moderators at info-mac. One thing we really want to start doing is adding URLs to the digests instead of the [Archived as...] line. This brings up some real problems, however, as sumex-aim is already greatly overloaded and to have everyone who reads info-mac in newswatcher pounding it for a file... well, that would be "bad". I think that mac.archive at umich has the same problem.
To solve this both archives have a fairly large set of mirror sites. Each person has their own fav mirror site for info-mac and the umich archive. Great. I thought it would be great if all the various gopher/etc. programs would do automatic mirror subsititution.
This package I've written, "URL Helper", attempts to do just that. It is a combination of a small library and a component. The component keeps track of a list of mirrors for each main site. When a program has a URL it wants to look up, it hands the URL to the component. The component sees if that URL matches any of its known mirror sites -- in some mirror list. So something like "ftp://sumex-aim.stanford.edu/info-mac/..." would match a site on the info-mac mirror list. The calling program can then retreive the various enabled mirrors for that site. Path translations, etc. are taken care of.
It is all done with text subsitution. Here is a short example. I didn't use the real info-mac mirror list, just a made up one. Here is what the internal mirror list looks like for info-mac:
"\p^0://sumex-aim.stanford.edu/info-mac/^1"
"\p^0://mac.archive.edu/pub/info-mac/^1"
"\p^0://mit.mit.edu/pub/mirrors/im/^1"
The "^N" are substitution characters. They can be in any order or any position in a mirror string.
And, when I run the test program, I get back the following (this is output of a test in the file main.c).
Full Test on: 'ftp://sumex-aim.stanford.edu/info-mac/grf/util/mac-graphics.hqx'
-> 'ftp://mit.mit.edu/pub/mirrors/im/grf/util/mac-graphics.hqx'
-> 'ftp://mac.archive.edu/pub/info-mac/grf/util/mac-graphics.hqx'
Where the "Full test on " line whas the input URL. The "->" are the resulting mirror URLS. Note that sumex-aim.stanford.edu doesn't appear in the output. That is because that was specified as a "no use" mirror...
The code to do this is pretty simple, when the library is used:
Attachment | Size |
---|---|
![]() | 266.99 KB |