kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit bf1940225adf1503a0f71caa8a54c07af0b098d1
parent 7a2e855d28d1984c1d60bd4606a4e345b975a69e
Author: Joris Vink <joris@coders.se>
Date:   Wed, 26 Jun 2013 16:58:01 +0200

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

Diffstat:
includes/kore.h | 6++++++
src/http.c | 2++
src/kore.c | 4++++
3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/includes/kore.h b/includes/kore.h @@ -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; diff --git a/src/http.c b/src/http.c @@ -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", diff --git a/src/kore.c b/src/kore.c @@ -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 (;;) {