[axel-commits] r27 - in /trunk: CREDITS axel.h conf.c conf.h conn.c text.c

appaji-guest at users.alioth.debian.org appaji-guest at users.alioth.debian.org
Thu Apr 3 11:01:31 UTC 2008


Author: appaji-guest
Date: Thu Apr  3 11:01:31 2008
New Revision: 27

URL: http://svn.debian.org/wsvn/axel/?sc=1&rev=27
Log:
Custom header support, thanks Eli Yukelzon

Modified:
    trunk/CREDITS
    trunk/axel.h
    trunk/conf.c
    trunk/conf.h
    trunk/conn.c
    trunk/text.c

Modified: trunk/CREDITS
URL: http://svn.debian.org/wsvn/axel/trunk/CREDITS?rev=27&op=diff
==============================================================================
--- trunk/CREDITS (original)
+++ trunk/CREDITS Thu Apr  3 11:01:31 2008
@@ -1,4 +1,7 @@
 An not-quite-sorted list of people who helped somehow:
+
+- Eli Yukelzon <reflog at gmail.com>
+  Custom Header Support
 
 - David Turnbull <dsturnbull at gmail.com>
   Large file support

Modified: trunk/axel.h
URL: http://svn.debian.org/wsvn/axel/trunk/axel.h?rev=27&op=diff
==============================================================================
--- trunk/axel.h (original)
+++ trunk/axel.h Thu Apr  3 11:01:31 2008
@@ -65,6 +65,7 @@
 
 /* Compiled-in settings							*/
 #define MAX_STRING		1024
+#define MAX_ADD_HEADERS	10
 #define MAX_REDIR		5
 #define AXEL_VERSION_STRING	"1.1"
 #define USER_AGENT		"Axel " AXEL_VERSION_STRING " (" ARCH ")"

Modified: trunk/conf.c
URL: http://svn.debian.org/wsvn/axel/trunk/conf.c?rev=27&op=diff
==============================================================================
--- trunk/conf.c (original)
+++ trunk/conf.c Thu Apr  3 11:01:31 2008
@@ -107,6 +107,9 @@
 			fprintf( stderr, _("Error in %s line %i.\n"), file, line );
 			return( 0 );
 		}
+		get_config_number( add_header_count );
+		for(i=0;i<conf->add_header_count;i++)
+			get_config_string( add_header[i] );
 	}
 	
 	fclose( fp );
@@ -137,6 +140,7 @@
 	conf->search_threads		= 3;
 	conf->search_amount		= 15;
 	conf->search_top		= 3;
+	conf->add_header_count	= 0;
 	
 	conf->interfaces = malloc( sizeof( if_t ) );
 	memset( conf->interfaces, 0, sizeof( if_t ) );

Modified: trunk/conf.h
URL: http://svn.debian.org/wsvn/axel/trunk/conf.h?rev=27&op=diff
==============================================================================
--- trunk/conf.h (original)
+++ trunk/conf.h Thu Apr  3 11:01:31 2008
@@ -44,6 +44,9 @@
 	int search_threads;
 	int search_amount;
 	int search_top;
+
+	int add_header_count;
+	char add_header[MAX_ADD_HEADERS][MAX_STRING];
 } conf_t;
 
 int conf_loadfile( conf_t *conf, char *file );

Modified: trunk/conn.c
URL: http://svn.debian.org/wsvn/axel/trunk/conn.c?rev=27&op=diff
==============================================================================
--- trunk/conn.c (original)
+++ trunk/conn.c Thu Apr  3 11:01:31 2008
@@ -251,11 +251,14 @@
 	else
 	{
 		char s[MAX_STRING];
-		
+		int i;
+
 		snprintf( s, MAX_STRING, "%s%s", conn->dir, conn->file );
 		conn->http->firstbyte = conn->currentbyte;
 		conn->http->lastbyte = conn->lastbyte;
 		http_get( conn->http, s );
+		for( i = 0; i < conn->conf->add_header_count; i++)
+			http_addheader( conn->http, "%s", conn->conf->add_header[i] );
 	}
 	return( 1 );
 }

Modified: trunk/text.c
URL: http://svn.debian.org/wsvn/axel/trunk/text.c?rev=27&op=diff
==============================================================================
--- trunk/text.c (original)
+++ trunk/text.c Thu Apr  3 11:01:31 2008
@@ -52,6 +52,7 @@
 	{ "help",		0,	NULL,	'h' },
 	{ "version",		0,	NULL,	'V' },
 	{ "alternate",		0,	NULL,	'a' },
+	{ "header",		1,	NULL,	'H' },
 	{ NULL,			0,	NULL,	0 }
 };
 #endif
@@ -67,7 +68,7 @@
 	search_t *search;
 	conf_t conf[1];
 	axel_t *axel;
-	int i, j;
+	int i, j, cur_head = 0;
 	char *s;
 	
 #ifdef I18N
@@ -88,12 +89,15 @@
 	{
 		int option;
 		
-		option = getopt_long( argc, argv, "s:n:o:S::NqvhHVa", axel_options, NULL );
+		option = getopt_long( argc, argv, "s:n:o:S::NqvhHVaH:", axel_options, NULL );
 		if( option == -1 )
 			break;
 		
 		switch( option )
 		{
+		case 'H':
+			strncpy( conf->add_header[cur_head++], optarg, MAX_STRING );
+			break;
 		case 's':
 			if( !sscanf( optarg, "%i", &conf->max_speed ) )
 			{
@@ -152,7 +156,7 @@
 			return( 1 );
 		}
 	}
-	
+	conf->add_header_count = cur_head;
 	if( j > -1 )
 		conf->verbose = j;
 	
@@ -518,6 +522,7 @@
 		"-n x\tSpecify maximum number of connections\n"
 		"-o f\tSpecify local output file\n"
 		"-S [x]\tSearch for mirrors and download from x servers\n"
+		"-H x\tAdd header string\n"
 		"-N\tJust don't use any proxy server\n"
 		"-q\tLeave stdout alone\n"
 		"-v\tMore status information\n"
@@ -533,6 +538,7 @@
 		"--num-connections=x\t-n x\tSpecify maximum number of connections\n"
 		"--output=f\t\t-o f\tSpecify local output file\n"
 		"--search[=x]\t\t-S [x]\tSearch for mirrors and download from x servers\n"
+		"--header=x\t\t-H x\tAdd header string\n"
 		"--no-proxy\t\t-N\tJust don't use any proxy server\n"
 		"--quiet\t\t\t-q\tLeave stdout alone\n"
 		"--verbose\t\t-v\tMore status information\n"




More information about the axel-commits mailing list