Re: [patch] Resolve not the name put in header

Jonas Fonseca <[email protected]>
Newsgroups gmane.comp.web.links
Message-ID <[email protected]>
Michael Somebody <[email protected]> wrote Sun, Dec 04, 2005:
> The patch following allows to enter in options dialog (for one session
> only) one host name to redirect all requests to. This is intended for
> debugging or tunneling sites which have virtual hosts. I hope someone
> will find it useful and maybe it'll be merged in the source.

I don't quite understand the tunneling part since there is only one
configurable address, so you'd have to change it for each new site.

> ---------patch begins------------

A few comments. The patch seems to be whitespace corrupted.

> diff -ur elinks-0.10-20050823/src/lowlevel/dns.c
> elinks-0.10-20050823.mod/src/lowlevel/dns.c
> --- elinks-0.10-20050823/src/lowlevel/dns.c	2005-05-01
> 15:15:32.000000000 -0600
> +++ elinks-0.10-20050823.mod/src/lowlevel/dns.c	2005-12-03
> 23:59:21.000000000 -0700
> @@ -86,9 +86,26 @@
>  #endif
>  	int i;
> 
> +	unsigned char * singleaddr, * oldname;
> +	FILE * log;
> +

The log variable seems to be leftovers from your debugging.
BTW, you can log to a file using LOG_{ERR,WARN,INFO,DBG} etc.
See src/util/error.h for info about env variables to set the log file
and the log level.

>  	if (!name || !addrs || !addrno)
>  		return -1;
> 
> +	if ((singleaddr=get_opt_str("protocol.single-address")) )

get_opt_str() always returns non-NULL, since all options are always
asserted to exist.

> +	{
> +		if (singleaddr[0])
> +		{
> +			oldname=name;
> +			name=singleaddr;
> +		}
> +		else
> +		{
> +			oldname=0;
> +		}
> +	}
> +
> +
>  #ifdef CONFIG_IPV6
>  	/* I had a strong preference for the following, but the glibc is 
>  	really
>  	 * obsolete so I had to rather use much more complicated 
>  	 getaddrinfo().
> @@ -112,6 +129,9 @@
>  	}
>  #endif
> 
> +	if(oldname)
> +		name=oldname;
> +
>  #ifdef CONFIG_IPV6
>  	for (i = 0, ai_cur = ai; ai_cur; i++, ai_cur = ai_cur->ai_next);
>  #else
> diff -ur elinks-0.10-20050823/src/protocol/protocol.c
> elinks-0.10-20050823.mod/src/protocol/protocol.c
> --- elinks-0.10-20050823/src/protocol/protocol.c	2005-05-01
> 15:32:11.000000000 -0600
> +++ elinks-0.10-20050823.mod/src/protocol/protocol.c	2005-12-03
> 23:13:15.000000000 -0700
> @@ -259,6 +259,10 @@
>  		"domains as well. If it's blank, NO_PROXY environment 
>  		variable is\n"
>  		"checked as well.")),
> 
> +	INIT_OPT_STRING("protocol", N_("One address to replace all the ip
> queries"),
> +		"single-address", 0, "",
> +		N_("All the queries will be sent with usual headers but to 
> this IP.")),
> +
>  	NULL_OPTION_INFO,
>  };
>  static struct module *protocol_submodules[] = {

I somehow feel this option belongs in the 'connections' subtree which is
more lowlevel than 'protocol', and also this really isn't related to any
protocol part but to connection setup.

[ CC'ed you since I cannot remember if you subscribed. ]

-- 
Jonas Fonseca
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.