File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ wrk 4.0.2
2+
3+ * Send hostname using TLS SNI.
4+ * Add optional WITH_OPENSSL and WITH_LUAJIT to use system libs.
5+ * Bundle OpenSSL 1.0.2.
16 * delay() can return milliseconds to delay sending next request.
27
38wrk 4.0.0
Original file line number Diff line number Diff line change 1+ Overview
2+
3+ wrk should build on most UNIX-like operating systems and
4+ architectures that have GNU make and are supported by LuaJIT and
5+ OpenSSL. Some systems may require additional CFLAGS or LDFLAGS,
6+ see the top of the Makefile for examples
7+
8+ In many cases simply running `make` (often `gmake` on *BSD) will
9+ do the trick.
10+
11+ Dependencies
12+
13+ wrk requires LuaJIT and OpenSSL and is distributed with appropriate
14+ versions that will be unpacked and built as necessary.
15+
16+ If you are building wrk packages for an OS distribution or otherwise
17+ prefer to use system versions of dependencies you may specify their
18+ location when invoking make with one or more of:
19+
20+ WITH_LUAJIT
21+ WITH_OPENSSL
22+
23+ For example to use the system version of both libraries on Linux:
24+
25+ make WITH_LUAJIT=/usr WITH_OPENSSL=/usr
26+
27+ Or to use the Homebrew version of OpenSSL on Mac OS X:
28+
29+ make WITH_OPENSSL=/usr/local/opt/openssl
Original file line number Diff line number Diff line change 66
77#include "net.h"
88
9- status sock_connect (connection * c ) {
9+ status sock_connect (connection * c , char * host ) {
1010 return OK ;
1111}
1212
Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ typedef enum {
1313} status ;
1414
1515struct sock {
16- status ( * connect )(connection * );
16+ status ( * connect )(connection * , char * );
1717 status ( * close )(connection * );
1818 status ( * read )(connection * , size_t * );
1919 status ( * write )(connection * , char * , size_t , size_t * );
2020 size_t (* readable )(connection * );
2121};
2222
23- status sock_connect (connection * );
23+ status sock_connect (connection * , char * );
2424status sock_close (connection * );
2525status sock_read (connection * , size_t * );
2626status sock_write (connection * , char * , size_t , size_t * );
Original file line number Diff line number Diff line change @@ -49,9 +49,10 @@ SSL_CTX *ssl_init() {
4949 return ctx ;
5050}
5151
52- status ssl_connect (connection * c ) {
52+ status ssl_connect (connection * c , char * host ) {
5353 int r ;
5454 SSL_set_fd (c -> ssl , c -> fd );
55+ SSL_set_tlsext_host_name (c -> ssl , host );
5556 if ((r = SSL_connect (c -> ssl )) != 1 ) {
5657 switch (SSL_get_error (c -> ssl , r )) {
5758 case SSL_ERROR_WANT_READ : return RETRY ;
Original file line number Diff line number Diff line change 55
66SSL_CTX * ssl_init ();
77
8- status ssl_connect (connection * );
8+ status ssl_connect (connection * , char * );
99status ssl_close (connection * );
1010status ssl_read (connection * , size_t * );
1111status ssl_write (connection * , char * , size_t , size_t * );
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ static struct config {
1313 bool delay ;
1414 bool dynamic ;
1515 bool latency ;
16+ char * host ;
1617 char * script ;
1718 SSL_CTX * ctx ;
1819} cfg ;
@@ -98,6 +99,8 @@ int main(int argc, char **argv) {
9899 exit (1 );
99100 }
100101
102+ cfg .host = host ;
103+
101104 for (uint64_t i = 0 ; i < cfg .threads ; i ++ ) {
102105 thread * t = & threads [i ];
103106 t -> loop = aeCreateEventLoop (10 + cfg .connections * 3 );
@@ -359,7 +362,7 @@ static int response_complete(http_parser *parser) {
359362static void socket_connected (aeEventLoop * loop , int fd , void * data , int mask ) {
360363 connection * c = data ;
361364
362- switch (sock .connect (c )) {
365+ switch (sock .connect (c , cfg . host )) {
363366 case OK : break ;
364367 case ERROR : goto error ;
365368 case RETRY : return ;
You can’t perform that action at this time.
0 commit comments