mirror of
https://github.com/wg/wrk
synced 2025-01-06 21:32:54 +08:00
send hostname in TLS SNI extension
This commit is contained in:
parent
040db59768
commit
50305ed1d8
5
CHANGES
5
CHANGES
@ -1,3 +1,8 @@
|
||||
wrk 4.0.2
|
||||
|
||||
* Send hostname using TLS SNI.
|
||||
* Add optional WITH_OPENSSL and WITH_LUAJIT to use system libs.
|
||||
* Bundle OpenSSL 1.0.2.
|
||||
* delay() can return milliseconds to delay sending next request.
|
||||
|
||||
wrk 4.0.0
|
||||
|
29
INSTALL
Normal file
29
INSTALL
Normal file
@ -0,0 +1,29 @@
|
||||
Overview
|
||||
|
||||
wrk should build on most UNIX-like operating systems and
|
||||
architectures that have GNU make and are supported by LuaJIT and
|
||||
OpenSSL. Some systems may require additional CFLAGS or LDFLAGS,
|
||||
see the top of the Makefile for examples
|
||||
|
||||
In many cases simply running `make` (often `gmake` on *BSD) will
|
||||
do the trick.
|
||||
|
||||
Dependencies
|
||||
|
||||
wrk requires LuaJIT and OpenSSL and is distributed with appropriate
|
||||
versions that will be unpacked and built as necessary.
|
||||
|
||||
If you are building wrk packages for an OS distribution or otherwise
|
||||
prefer to use system versions of dependencies you may specify their
|
||||
location when invoking make with one or more of:
|
||||
|
||||
WITH_LUAJIT
|
||||
WITH_OPENSSL
|
||||
|
||||
For example to use the system version of both libraries on Linux:
|
||||
|
||||
make WITH_LUAJIT=/usr WITH_OPENSSL=/usr
|
||||
|
||||
Or to use the Homebrew version of OpenSSL on Mac OS X:
|
||||
|
||||
make WITH_OPENSSL=/usr/local/opt/openssl
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "net.h"
|
||||
|
||||
status sock_connect(connection *c) {
|
||||
status sock_connect(connection *c, char *host) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -13,14 +13,14 @@ typedef enum {
|
||||
} status;
|
||||
|
||||
struct sock {
|
||||
status ( *connect)(connection *);
|
||||
status ( *connect)(connection *, char *);
|
||||
status ( *close)(connection *);
|
||||
status ( *read)(connection *, size_t *);
|
||||
status ( *write)(connection *, char *, size_t, size_t *);
|
||||
size_t (*readable)(connection *);
|
||||
};
|
||||
|
||||
status sock_connect(connection *);
|
||||
status sock_connect(connection *, char *);
|
||||
status sock_close(connection *);
|
||||
status sock_read(connection *, size_t *);
|
||||
status sock_write(connection *, char *, size_t, size_t *);
|
||||
|
@ -49,9 +49,10 @@ SSL_CTX *ssl_init() {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
status ssl_connect(connection *c) {
|
||||
status ssl_connect(connection *c, char *host) {
|
||||
int r;
|
||||
SSL_set_fd(c->ssl, c->fd);
|
||||
SSL_set_tlsext_host_name(c->ssl, host);
|
||||
if ((r = SSL_connect(c->ssl)) != 1) {
|
||||
switch (SSL_get_error(c->ssl, r)) {
|
||||
case SSL_ERROR_WANT_READ: return RETRY;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
SSL_CTX *ssl_init();
|
||||
|
||||
status ssl_connect(connection *);
|
||||
status ssl_connect(connection *, char *);
|
||||
status ssl_close(connection *);
|
||||
status ssl_read(connection *, size_t *);
|
||||
status ssl_write(connection *, char *, size_t, size_t *);
|
||||
|
@ -13,6 +13,7 @@ static struct config {
|
||||
bool delay;
|
||||
bool dynamic;
|
||||
bool latency;
|
||||
char *host;
|
||||
char *script;
|
||||
SSL_CTX *ctx;
|
||||
} cfg;
|
||||
@ -98,6 +99,8 @@ int main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cfg.host = host;
|
||||
|
||||
for (uint64_t i = 0; i < cfg.threads; i++) {
|
||||
thread *t = &threads[i];
|
||||
t->loop = aeCreateEventLoop(10 + cfg.connections * 3);
|
||||
@ -359,7 +362,7 @@ static int response_complete(http_parser *parser) {
|
||||
static void socket_connected(aeEventLoop *loop, int fd, void *data, int mask) {
|
||||
connection *c = data;
|
||||
|
||||
switch (sock.connect(c)) {
|
||||
switch (sock.connect(c, cfg.host)) {
|
||||
case OK: break;
|
||||
case ERROR: goto error;
|
||||
case RETRY: return;
|
||||
|
Loading…
Reference in New Issue
Block a user