Re: How to expand a relative URL into an absolute one ?

On Mon, 23 Aug 1999, Michael Maretzke wrote:
> I parse a "<a href="./foo.html"> ... </a>" using the callback-functions.
> This file is located on a server called "http://www.foo.com" and is stored
> in
> directory "/test/test2/". "/" is here the WWW-root-directory.
> 
> Extracting the parameter file "./foo.html" is no problem. But now I've
> to expand this relative URL "./foo.html" into an absolute one
> "http://www.foo.com/test/test2/foo.html". How may I do this ?
> Which one of these libwww-servicefunctions is the right one for me ?

I'm currently using 'HTAnchor_followMainLink' and 'HTAnchor_address'
(from a sample program findlinks).
maybe it would help...

void foundLink (HText * text, int element_number, int attribute_number,
	HTChildAnchor * anchor,	const BOOL * present, const char ** value)
{
    if (anchor) {
	HTAnchor * dest = HTAnchor_followMainLink((HTAnchor *) anchor);
	char * address = HTAnchor_address(dest);
...

Evguenii

Received on Monday, 23 August 1999 06:22:45 UTC