Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > d693a950e0f5ef326e20fba82864e6e7 > files > 18

apache-2.4.4-7.mga3.src.rpm

diff -Naurp httpd-2.4.4/docs/man/ab.1 httpd-2.4.4.oden/docs/man/ab.1
--- httpd-2.4.4/docs/man/ab.1	2013-01-09 13:28:34.000000000 +0100
+++ httpd-2.4.4.oden/docs/man/ab.1	2013-02-26 10:57:07.867145547 +0100
@@ -124,6 +124,9 @@ String to use as attributes for <table>\
 -X \fIproxy\fR[:\fIport\fR]
 Use a proxy server for the requests\&.  
 .TP
+-o \fIsrc_address\fR
+Set the local source address\&.  
+.TP
 -y \fI<tr>-attributes\fR
 String to use as attributes for <tr>\&.  
 .TP
diff -Naurp httpd-2.4.4/support/ab.c httpd-2.4.4.oden/support/ab.c
--- httpd-2.4.4/support/ab.c	2013-01-08 15:25:15.000000000 +0100
+++ httpd-2.4.4.oden/support/ab.c	2013-02-26 10:59:34.866137449 +0100
@@ -294,6 +294,7 @@ int proxyport = 0;      /* proxy port */
 const char *connecthost;
 const char *myhost;
 apr_port_t connectport;
+char *src_address;
 const char *gnuplot;          /* GNUplot file */
 const char *csvperc;          /* CSV Percentile file */
 char url[1024];
@@ -1171,6 +1172,7 @@ static void output_html_results(void)
 static void start_connect(struct connection * c)
 {
     apr_status_t rv;
+    apr_sockaddr_t *from;
 
     if (!(started < requests))
     return;
@@ -1220,6 +1222,14 @@ static void start_connect(struct connect
         }
     }
 
+    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) {
@@ -1898,6 +1908,7 @@ static void usage(const char *progname)
     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, "    -o 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");
@@ -2087,7 +2098,7 @@ int main(int argc, const char * const ar
     myhost = NULL; /* 0.0.0.0 or :: */
 
     apr_getopt_init(&opt, cntxt, argc, argv);
-    while ((status = apr_getopt(opt, "n:c:t:s:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:SqB:"
+    while ((status = apr_getopt(opt, "o:n:c:t:s:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:SqB:"
 #ifdef USE_SSL
             "Z:f:"
 #endif
@@ -2102,6 +2113,9 @@ int main(int argc, const char * const ar
             case 'k':
                 keepalive = 1;
                 break;
+            case 'o':
+                src_address = strdup(optarg);
+                break;
             case 'q':
                 heartbeatres = 0;
                 break;