Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > f331466ffcef1a5c613554bb604033ee > files > 43

apache-2.2.23-1.mga1.src.rpm

diff -Naur -x '*~' -x '*.orig' -x '*.rej' httpd-2.2.23/docs/man/ab.8 httpd-2.2.23-ab_source_address/docs/man/ab.8
--- httpd-2.2.23/docs/man/ab.8	2012-01-11 00:32:02.000000000 +0100
+++ httpd-2.2.23-ab_source_address/docs/man/ab.8	2012-02-07 11:31:56.259951571 +0100
@@ -121,6 +121,9 @@
 -X \fIproxy\fR[:\fIport\fR]
 Use a proxy server for the requests\&.  
 .TP
+-s \fIsrc_address\fR
+Set the local source address\&.  
+.TP
 -y \fI<tr>-attributes\fR
 String to use as attributes for <tr>\&.  
 .TP
diff -Naur -x '*~' -x '*.orig' -x '*.rej' httpd-2.2.23/support/ab.c httpd-2.2.23-ab_source_address/support/ab.c
--- httpd-2.2.23/support/ab.c	2011-04-14 15:56:17.000000000 +0200
+++ httpd-2.2.23-ab_source_address/support/ab.c	2012-02-07 11:31:56.262951535 +0100
@@ -299,6 +299,7 @@
 int proxyport = 0;      /* proxy port */
 char *connecthost;
 apr_port_t connectport;
+char *src_address;
 char *gnuplot;          /* GNUplot file */
 char *csvperc;          /* CSV Percentile file */
 char url[1024];
@@ -1147,6 +1148,7 @@
 static void start_connect(struct connection * c)
 {
     apr_status_t rv;
+    apr_sockaddr_t *from;
 
     if (!(started < requests))
     return;
@@ -1184,6 +1186,14 @@
         }
     }
 
+    if (src_address) {
+        if ((rv = apr_sockaddr_info_get(&from, src_address, destsa->family,
+                0, 0, c->ctx)) != APR_SUCCESS)
+                apr_err("src_address get", rv);
+        if ((rv = apr_socket_bind(c->aprsock, from)) != APR_SUCCESS)
+            apr_err("src_address bind", rv);
+    }
+
     c->start = lasttime = apr_time_now();
 #ifdef USE_SSL
     if (is_ssl) {
@@ -1866,6 +1876,7 @@
     fprintf(stderr, "    -P attribute    Add Basic Proxy Authentication, the attributes\n");
     fprintf(stderr, "                    are a colon separated username and password.\n");
     fprintf(stderr, "    -X proxy:port   Proxyserver and port number to use\n");
+    fprintf(stderr, "    -s src_address  Set the local source address\n");
     fprintf(stderr, "    -V              Print version number and exit\n");
     fprintf(stderr, "    -k              Use HTTP KeepAlive feature\n");
     fprintf(stderr, "    -d              Do not show percentiles served table.\n");
@@ -2044,7 +2055,7 @@
 #endif
 
     apr_getopt_init(&opt, cntxt, argc, argv);
-    while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
+    while ((status = apr_getopt(opt, "s:n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
 #ifdef USE_SSL
             "Z:f:"
 #endif
@@ -2059,6 +2070,9 @@
             case 'k':
                 keepalive = 1;
                 break;
+            case 's':
+                src_address = strdup(optarg);
+                break;
             case 'q':
                 heartbeatres = 0;
                 break;