everybody loves to tout their own horn.. so introduce a server response header

This commit is contained in:
Joris Vink 2013-06-26 16:58:01 +02:00
parent 7a2e855d28
commit bf1940225a
3 changed files with 12 additions and 0 deletions

View File

@ -21,6 +21,11 @@
#define KORE_RESULT_OK 1
#define KORE_RESULT_RETRY 2
#define KORE_VERSION_MAJOR 0
#define KORE_VERSION_MINOR 1
#define KORE_VERSION_PATCH 0
#define KORE_NAME_STRING "kore"
#define errno_s strerror(errno)
#define ssl_errno_s ERR_error_string(ERR_get_error(), NULL)
@ -147,6 +152,7 @@ extern char *runas_user;
extern char *kore_module_onload;
extern char *kore_pidfile;
extern char *config_file;
extern char kore_version_string[];
extern u_int16_t cpu_count;
extern u_int8_t worker_count;

View File

@ -230,6 +230,7 @@ http_response(struct http_request *req, int status, u_int8_t *d, u_int32_t len)
hblock = spdy_header_block_create(SPDY_HBLOCK_NORMAL);
spdy_header_block_add(hblock, ":status", sbuf);
spdy_header_block_add(hblock, ":version", "HTTP/1.1");
spdy_header_block_add(hblock, ":server", kore_version_string);
TAILQ_FOREACH(hdr, &(req->resp_headers), list)
spdy_header_block_add(hblock, hdr->header, hdr->value);
@ -256,6 +257,7 @@ http_response(struct http_request *req, int status, u_int8_t *d, u_int32_t len)
kore_buf_appendf(buf, "HTTP/1.1 %d\r\n", status);
kore_buf_appendf(buf, "Content-length: %d\r\n", len);
kore_buf_appendf(buf, "Connection: keep-alive\r\n");
kore_buf_appendf(buf, "Server: %s\r\n", kore_version_string);
TAILQ_FOREACH(hdr, &(req->resp_headers), list) {
kore_buf_appendf(buf, "%s: %s\r\n",

View File

@ -56,6 +56,7 @@ u_int8_t worker_count = 0;
char *server_ip = NULL;
char *runas_user = NULL;
char *chroot_path = NULL;
char kore_version_string[32];
char *kore_pidfile = KORE_PIDFILE_DEFAULT;
static void usage(void);
@ -182,6 +183,9 @@ kore_server_start(void)
kore_log(LOG_NOTICE, "kore is starting up");
kore_platform_proctitle("kore [parent]");
snprintf(kore_version_string, sizeof(kore_version_string),
"%s-%d.%d.%d", KORE_NAME_STRING, KORE_VERSION_MAJOR,
KORE_VERSION_MINOR, KORE_VERSION_PATCH);
kore_worker_init();
for (;;) {