You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/04/01 19:01:51 UTC
[1/2] git commit: TS-1771: add http_load to the build
Updated Branches:
refs/heads/master 3e76711e9 -> 4aa69fb35
TS-1771: add http_load to the build
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/4aa69fb3
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/4aa69fb3
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/4aa69fb3
Branch: refs/heads/master
Commit: 4aa69fb3514ac197c94c1b8419b0a862dd57e18d
Parents: 2d491e2
Author: James Peach <jp...@apache.org>
Authored: Sun Mar 24 11:24:12 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 1 09:56:22 2013 -0700
----------------------------------------------------------------------
configure.ac | 2 +
tools/Makefile.am | 12 ++++++
tools/http_load/Makefile | 52 ----------------------------
tools/http_load/http_load.c | 70 +++-----------------------------------
tools/http_load/version.h | 8 ----
5 files changed, 19 insertions(+), 125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4aa69fb3/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index fe1648a..7b30f26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1233,6 +1233,8 @@ esac
AC_SUBST(LUA_LUAJIT_LDFLAGS)
+# We should be able to build http_load if epoll(2) is available.
+AM_CONDITIONAL([BUILD_HTTP_LOAD], [test x"$ac_cv_func_epoll_ctl" = x"yes"])
# -----------------------------------------------------------------------------
# 5. CHECK FOR HEADER FILES
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4aa69fb3/tools/Makefile.am
----------------------------------------------------------------------
diff --git a/tools/Makefile.am b/tools/Makefile.am
index d009d4d..e9e50ba 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -22,3 +22,15 @@ bin_SCRIPTS = tsxs
noinst_PROGRAMS = jtest/jtest
jtest_jtest_SOURCES = jtest/jtest.cc
+
+if BUILD_HTTP_LOAD
+noinst_PROGRAMS += http_load/http_load
+
+http_load_http_load_LDADD = @LIBSSL@
+http_load_http_load_SOURCES = \
+ http_load/http_load.c \
+ http_load/timers.c \
+ http_load/port.h \
+ http_load/timers.h
+
+endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4aa69fb3/tools/http_load/Makefile
----------------------------------------------------------------------
diff --git a/tools/http_load/Makefile b/tools/http_load/Makefile
deleted file mode 100644
index 64a8bc5..0000000
--- a/tools/http_load/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-# Makefile for http_load
-
-# CONFIGURE: If you are using a SystemV-based operating system, such as
-# Solaris, you will need to uncomment this definition.
-#SYSV_LIBS = -lnsl -lsocket -lresolv
-
-# CONFIGURE: If you want to compile in support for https, uncomment these
-# definitions. You will need to have already built OpenSSL, available at
-# http://www.openssl.org/ Make sure the SSL_TREE definition points to the
-# tree with your OpenSSL installation - depending on how you installed it,
-# it may be in /usr/local instead of /usr/local/ssl.
-#SSL_TREE = /usr/local/ssl
-#SSL_DEFS = -DUSE_SSL
-#SSL_INC = -I$(SSL_TREE)/include
-#SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto
-
-BINDIR = /usr/local/bin
-MANDIR = /usr/local/man/man1
-CC = gcc -Wall
-CFLAGS = -g -O3 $(SRANDOM_DEFS) $(SSL_DEFS) $(SSL_INC)
-LDFLAGS = $(SSL_LIBS) $(SYSV_LIBS)
-
-
-all: http_load
-
-http_load: http_load.o timers.o
- $(CC) $(CFLAGS) http_load.o timers.o $(LDFLAGS) -o http_load
-
-http_load.o: http_load.c timers.h port.h
- $(CC) $(CFLAGS) -c http_load.c
-
-timers.o: timers.c timers.h
- $(CC) $(CFLAGS) -c timers.c
-
-install: all
- rm -f $(BINDIR)/http_load
- cp http_load $(BINDIR)
- rm -f $(MANDIR)/http_load.1
- cp http_load.1 $(MANDIR)
-
-clean:
- rm -f http_load *.o core core.* *.core
-
-tar:
- @name=`sed -n -e '/define VERSION /!d' -e 's,.*http_load ,http_load-,' -e 's,",,p' version.h` ; \
- rm -rf $$name ; \
- mkdir $$name ; \
- tar cf - `cat FILES` | ( cd $$name ; tar xfBp - ) ; \
- chmod 644 $$name/Makefile ; \
- tar cf $$name.tar $$name ; \
- rm -rf $$name ; \
- gzip $$name.tar
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4aa69fb3/tools/http_load/http_load.c
----------------------------------------------------------------------
diff --git a/tools/http_load/http_load.c b/tools/http_load/http_load.c
index 3435bb1..229320a 100644
--- a/tools/http_load/http_load.c
+++ b/tools/http_load/http_load.c
@@ -25,10 +25,9 @@
** SUCH DAMAGE.
*/
-#ifdef linux
-#include <sys/epoll.h>
-#endif
+#include "ink_config.h"
+#include <sys/epoll.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -45,13 +44,10 @@
#include <errno.h>
#include <signal.h>
-#ifdef USE_SSL
#include <openssl/ssl.h>
#include <openssl/rand.h>
#include <openssl/err.h>
-#endif
-#include "version.h"
#include "port.h"
#include "timers.h"
@@ -116,9 +112,7 @@ static int num_sips, max_sips;
/* Protocol symbols. */
#define PROTO_HTTP 0
-#ifdef USE_SSL
#define PROTO_HTTPS 1
-#endif
/* Connection states */
typedef enum
@@ -222,9 +216,7 @@ typedef struct
struct sockaddr_in sa;
int sa_len;
int conn_fd;
-#ifdef USE_SSL
SSL *ssl;
-#endif
connection_states conn_state;
header_states header_state;
int did_connect, did_response;
@@ -284,10 +276,8 @@ int total_timeouts, total_badbytes, total_badchecksums;
static long start_interval, low_interval, high_interval, range_interval;
-#ifdef USE_SSL
static SSL_CTX *ssl_ctx = (SSL_CTX *) 0;
static char *cipher = (char *) 0;
-#endif
/* Forwards. */
static void usage(void);
@@ -332,9 +322,7 @@ main(int argc, char **argv)
#ifdef RLIMIT_NOFILE
struct rlimit limits;
#endif /* RLIMIT_NOFILE */
-#ifdef linux
struct epoll_event *events;
-#endif
struct timeval now;
int i, r, periodic_tmr;
@@ -464,7 +452,6 @@ main(int argc, char **argv)
http_version = argv[++argn];
is_http_1_1 = (strcmp(http_version, "1.1") == 0);
}
-#ifdef USE_SSL
else if (strncmp(argv[argn], "-cipher", strlen(argv[argn])) == 0 && argn + 1 < argc) {
cipher = argv[++argn];
if (strcasecmp(cipher, "fastsec") == 0)
@@ -474,7 +461,6 @@ main(int argc, char **argv)
else if (strcasecmp(cipher, "paranoid") == 0)
cipher = "AES256-SHA";
}
-#endif /* USE_SSL */
else if (strncmp(argv[argn], "-proxy", strlen(argv[argn])) == 0 && argn + 1 < argc) {
char *colon;
do_proxy = 1;
@@ -539,14 +525,12 @@ main(int argc, char **argv)
total_badchecksums = 0;
/* Initialize epoll() and kqueue() etc. */
-#ifdef linux
epfd = epoll_create(max_connections);
if (epfd == -1) {
perror("epoll_create");
exit(1);
}
events = malloc(sizeof(struct epoll_event) * max_connections);
-#endif
/* Initialize the random number generator. */
#ifdef HAVE_SRANDOMDEV
@@ -641,9 +625,7 @@ usage(void)
" [-keep_alive num_reqs_per_conn] [-unique_id]\n"
" [-max_connect_failures N] [-ignore_bytes] [ [-header str] ... ]\n",
argv0);
-#ifdef USE_SSL
(void) fprintf(stderr, " [-cipher str]\n");
-#endif /* USE_SSL */
(void) fprintf(stderr, " -parallel N | -rate N [-jitter]\n");
(void) fprintf(stderr, " -fetches N | -seconds N\n");
(void) fprintf(stderr, " url_file\n");
@@ -660,10 +642,8 @@ read_url_file(char *url_file)
char line[5000], hostname[5000];
char *http = "http://";
int http_len = strlen(http);
-#ifdef USE_SSL
char *https = "https://";
int https_len = strlen(https);
-#endif
int proto_len, host_len;
char *cp;
@@ -718,12 +698,10 @@ read_url_file(char *url_file)
proto_len = http_len;
urls[num_urls].protocol = PROTO_HTTP;
}
-#ifdef USE_SSL
else if (strncmp(https, line, https_len) == 0) {
proto_len = https_len;
urls[num_urls].protocol = PROTO_HTTPS;
}
-#endif
else {
(void) fprintf(stderr, "%s: unknown protocol - %s\n", argv0, line);
exit(1);
@@ -739,14 +717,10 @@ read_url_file(char *url_file)
while (*cp != '\0' && *cp != '/')
++cp;
} else
-#ifdef USE_SSL
if (urls[num_urls].protocol == PROTO_HTTPS)
urls[num_urls].port = 443;
else
urls[num_urls].port = 80;
-#else
- urls[num_urls].port = 80;
-#endif
if (*cp == '\0')
urls[num_urls].filename = strdup_check("/");
else
@@ -760,14 +734,9 @@ read_url_file(char *url_file)
/* Pregenereate the request string, major performance improvement. */
if (do_proxy) {
-#ifdef USE_SSL
req_bytes = snprintf(req_buf, sizeof(req_buf), "GET %s://%.500s:%d%.500s HTTP/%s\r\n",
urls[num_urls].protocol == PROTO_HTTPS ? "https" : "http",
urls[num_urls].hostname, (int) urls[num_urls].port, urls[num_urls].filename, http_version);
-#else
- req_bytes = snprintf(req_buf, sizeof(req_buf), "GET http://%.500s:%d%.500s HTTP/%s\r\n",
- urls[num_urls].hostname, (int) urls[num_urls].port, urls[num_urls].filename, http_version);
-#endif
} else
req_bytes = snprintf(req_buf, sizeof(req_buf), "GET %.500s HTTP/%s\r\n", urls[num_urls].filename, http_version);
@@ -1072,9 +1041,7 @@ start_socket(int url_num, int cnum, struct timeval *nowP)
/* Make a socket. */
if (!reusable) {
-#ifdef linux
struct epoll_event ev;
-#endif
connections[cnum].keep_alive = keep_alive;
connections[cnum].conn_fd = socket(urls[url_num].sock_family, urls[url_num].sock_type, urls[url_num].sock_protocol);
@@ -1106,7 +1073,6 @@ start_socket(int url_num, int cnum, struct timeval *nowP)
return;
}
}
-#ifdef linux
ev.events = EPOLLOUT;
ev.data.u32 = cnum;
#ifdef DEBUG
@@ -1117,7 +1083,6 @@ start_socket(int url_num, int cnum, struct timeval *nowP)
(void) close(connections[cnum].conn_fd);
return;
}
-#endif
/* Connect to the host. */
connections[cnum].sa_len = urls[url_num].sa_len;
(void) memmove((void *) &connections[cnum].sa, (void *) &urls[url_num].sa, urls[url_num].sa_len);
@@ -1127,11 +1092,9 @@ start_socket(int url_num, int cnum, struct timeval *nowP)
connections[cnum].conn_state = CNST_CONNECTING;
return;
} else {
-#ifdef linux
/* remove the FD from the epoll descriptor */
if (epoll_ctl(epfd, EPOLL_CTL_DEL, connections[cnum].conn_fd, &ev) < 0)
perror("epoll delete fd");
-#endif
perror(urls[url_num].url_str);
(void) close(connections[cnum].conn_fd);
return;
@@ -1149,14 +1112,10 @@ start_socket(int url_num, int cnum, struct timeval *nowP)
connections[cnum].stats.requests_per_connection++;
connections[cnum].request_at = *nowP;
-#ifdef USE_SSL
if (urls[url_num].protocol == PROTO_HTTPS)
r = SSL_write(connections[cnum].ssl, urls[url_num].buf, urls[url_num].buf_bytes);
else
r = write(connections[cnum].conn_fd, urls[url_num].buf, urls[url_num].buf_bytes);
-#else
- r = write(connections[cnum].conn_fd, urls[url_num].buf, urls[url_num].buf_bytes);
-#endif
if (r < 0) {
perror(urls[url_num].url_str);
connections[cnum].reusable = 0;
@@ -1168,13 +1127,11 @@ start_socket(int url_num, int cnum, struct timeval *nowP)
}
}
-#ifdef USE_SSL
static int
cert_verify_callback(int ok, X509_STORE_CTX *ctx)
{
return 1;
}
-#endif
static void
handle_connect(int cnum, struct timeval *nowP, int double_check)
@@ -1182,9 +1139,7 @@ handle_connect(int cnum, struct timeval *nowP, int double_check)
static int connect_failures = 0;
int url_num;
int r;
-#ifdef linux
struct epoll_event ev;
-#endif
#ifdef DEBUG
fprintf(stderr, "Entering handle_connect() for CNUM %d\n", cnum);
@@ -1218,7 +1173,7 @@ handle_connect(int cnum, struct timeval *nowP, int double_check)
}
}
}
-#ifdef USE_SSL
+
if (urls[url_num].protocol == PROTO_HTTPS) {
int flags;
@@ -1260,10 +1215,10 @@ handle_connect(int cnum, struct timeval *nowP, int double_check)
return;
}
}
-#endif
-#ifdef linux
+
ev.events = EPOLLIN;
ev.data.u32 = cnum;
+
#ifdef DEBUG
fprintf(stderr, "Mod FD %d to read for CNUM %d\n", connections[cnum].conn_fd, cnum);
#endif
@@ -1272,19 +1227,14 @@ handle_connect(int cnum, struct timeval *nowP, int double_check)
(void) close(connections[cnum].conn_fd);
return;
}
-#endif
/* Send the request. */
connections[cnum].did_connect = 1;
connections[cnum].request_at = *nowP;
connections[cnum].stats.requests++;
-#ifdef USE_SSL
if (urls[url_num].protocol == PROTO_HTTPS)
r = SSL_write(connections[cnum].ssl, urls[url_num].buf, urls[url_num].buf_bytes);
else
r = write(connections[cnum].conn_fd, urls[url_num].buf, urls[url_num].buf_bytes);
-#else
- r = write(connections[cnum].conn_fd, urls[url_num].buf, urls[url_num].buf_bytes);
-#endif
if (r < 0) {
perror(urls[url_num].url_str);
connections[cnum].reusable = 0;
@@ -1326,14 +1276,10 @@ handle_read(int cnum, struct timeval *nowP)
num_ka_conns--;
}
}
-#ifdef USE_SSL
if (urls[connections[cnum].url_num].protocol == PROTO_HTTPS)
bytes_read = SSL_read(connections[cnum].ssl, buf, bytes_to_read - 1);
else
bytes_read = read(connections[cnum].conn_fd, buf, bytes_to_read - 1);
-#else
- bytes_read = read(connections[cnum].conn_fd, buf, bytes_to_read - 1);
-#endif
if (bytes_read <= 0) {
connections[cnum].reusable = 0;
close_connection(cnum);
@@ -2863,18 +2809,14 @@ close_connection(int cnum)
int url_num;
if (!connections[cnum].reusable) {
-#ifdef linux
struct epoll_event ev;
ev.events = EPOLLIN | EPOLLOUT;
ev.data.u32 = cnum;
if (epoll_ctl(epfd, EPOLL_CTL_DEL, connections[cnum].conn_fd, &ev) < 0)
perror("epoll delete fd");
-#endif
-#ifdef USE_SSL
if (urls[connections[cnum].url_num].protocol == PROTO_HTTPS)
SSL_free(connections[cnum].ssl);
-#endif
(void) close(connections[cnum].conn_fd);
} else {
--connections[cnum].keep_alive;
@@ -3021,10 +2963,8 @@ finish(struct timeval *nowP)
}
tmr_destroy();
-#ifdef USE_SSL
if (ssl_ctx != (SSL_CTX *) 0)
SSL_CTX_free(ssl_ctx);
-#endif
exit(0);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4aa69fb3/tools/http_load/version.h
----------------------------------------------------------------------
diff --git a/tools/http_load/version.h b/tools/http_load/version.h
deleted file mode 100644
index f857bb3..0000000
--- a/tools/http_load/version.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* version.h - version define for http_load */
-
-#ifndef _VERSION_H_
-#define _VERSION_H_
-
-#define VERSION "http_load 29jun2005"
-
-#endif /* _VERSION_H_ */
[2/2] git commit: TS-1764: fix spdy plugin build
Posted by jp...@apache.org.
TS-1764: fix spdy plugin build
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2d491e28
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2d491e28
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2d491e28
Branch: refs/heads/master
Commit: 2d491e28bfc7ac0eb83ff3bfff59b8306c752d82
Parents: 3e76711
Author: James Peach <jp...@apache.org>
Authored: Mon Apr 1 09:55:51 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 1 09:56:22 2013 -0700
----------------------------------------------------------------------
plugins/experimental/spdy/Makefile.am | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2d491e28/plugins/experimental/spdy/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/spdy/Makefile.am b/plugins/experimental/spdy/Makefile.am
index 2946ded..86163b6 100644
--- a/plugins/experimental/spdy/Makefile.am
+++ b/plugins/experimental/spdy/Makefile.am
@@ -24,6 +24,7 @@ check_PROGRAMS = zstream_test
AM_CPPFLAGS = \
-I$(srcdir)/lib \
+ -I$(top_srcdir)/lib/ts \
-I$(top_builddir)/proxy/api \
-D__STDC_FORMAT_MACROS=1