Allow multiple -H/--header options to be specified

for proxies that need multiple headers to be coaxed into tunneling


git-svn-id: https://proxytunnel.svn.sourceforge.net/svnroot/proxytunnel/trunk/proxytunnel@142 bc163920-b10d-0410-b2c5-a5491ca2ceef
This commit is contained in:
Mark Janssen 2006-10-05 09:55:55 +00:00
parent fc807ecd28
commit 42913f3c39
4 changed files with 10 additions and 6 deletions

View file

@ -1,5 +1,7 @@
Changes to proxytunnel version 1.6.4 -- xxx
- Allow multiple '-H' options (headers), total size of the headers
should not exceed 1k.
- Reworked setproctitle calls, giving an argument to -x should now
really hide all traces of the original name, not only the arguments
Also remove argument-info on normal (without -x) runs.

View file

@ -144,7 +144,7 @@ int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *ar
args_info->proxyhost_arg = NULL; \
args_info->dest_arg = NULL; \
args_info->remproxy_arg = NULL; \
args_info->header_arg = NULL; \
args_info->header_arg[0] = '\0'; \
args_info->verbose_flag = 0; \
args_info->ntlm_flag = 0; \
args_info->inetd_flag = 0; \
@ -363,8 +363,8 @@ int cmdline_parser( int argc, char * const *argv, struct gengetopt_args_info *ar
case 'H': /* Extra headers to send to HTTPS proxy. */
args_info->header_given++;
/* FIXME in case of multiple headers, later... */
args_info->header_arg = gengetopt_strdup (optarg);
strlcat( args_info->header_arg, optarg, MAX_HEADER_SIZE );
strlcat( args_info->header_arg, "\r\n", MAX_HEADER_SIZE );
break;
case 'v': /* Turn on verbosity. */

View file

@ -23,6 +23,8 @@
#ifndef _cmdline_h
#define _cmdline_h
#define MAX_HEADER_SIZE 1024
struct gengetopt_args_info {
char * user_arg; /* Username to send to HTTPS proxy for auth. */
char * pass_arg; /* Password to send to HTTPS proxy for auth. */
@ -31,7 +33,7 @@ struct gengetopt_args_info {
char * proxyhost_arg; /* HTTPS Proxy host to connect to. */
int proxyport_arg; /* HTTPS Proxy host portnumber to connect to. */
char * dest_arg; /* Destination host to built the tunnel to. */
char * header_arg; /* Extra headers to send to HTTPS proxy */
char header_arg[MAX_HEADER_SIZE]; /* Extra headers to send to HTTPS proxy */
char * remproxy_arg; /* Remote proxy to tunnel to. */
int verbose_flag; /* Turn on verbosity (default=off). */
int ntlm_flag; /* Turn on ntlm (default=off). */

4
http.c
View file

@ -154,7 +154,7 @@ void proxy_protocol()
/*
* Add extra header(s)
*/
sprintf( buf, "%s%s\r\n", buf, args_info.header_arg );
sprintf( buf, "%s%s", buf, args_info.header_arg );
}
sprintf( buf, "%sProxy-Connection: Keep-Alive\r\n\r\n", buf );
@ -198,7 +198,7 @@ void proxy_protocol()
* Add extra header(s)
*/
if ( args_info.header_given )
sprintf( buf, "%s%s\r\n", buf, args_info.header_arg );
sprintf( buf, "%s%s", buf, args_info.header_arg );
sprintf( buf, "%sProxy-Connection: Keep-Alive\r\n\r\n", buf );
/*