summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--auto/make2
-rw-r--r--src/nxt_application.c3
-rw-r--r--src/nxt_application.h1
-rw-r--r--src/nxt_controller.c4
-rw-r--r--src/nxt_http_request.c2
-rw-r--r--src/nxt_main.h1
-rw-r--r--src/nxt_php_sapi.c2
-rw-r--r--src/nxt_python_wsgi.c18
-rw-r--r--src/perl/nxt_perl_psgi.c3
-rw-r--r--src/ruby/nxt_ruby.c5
10 files changed, 37 insertions, 4 deletions
diff --git a/auto/make b/auto/make
index 477439d9..cdd32e20 100644
--- a/auto/make
+++ b/auto/make
@@ -224,7 +224,7 @@ ${NXT_DAEMON}-uninstall:
END
-nxt_version=`grep NXT_VERSION src/nxt_main.h | sed -e 's/.*"\(.*\)".*/\1/'`
+nxt_version=`grep -m 1 NXT_VERSION src/nxt_main.h | sed -e 's/.*"\(.*\)".*/\1/'`
# Makefile.
# *.dSYM is MacOSX Clang debug information.
diff --git a/src/nxt_application.c b/src/nxt_application.c
index 22461e57..ef15ab2b 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -41,6 +41,9 @@ static uint32_t compat[] = {
};
+nxt_str_t nxt_server = nxt_string(NXT_SERVER);
+
+
static nxt_thread_mutex_t nxt_app_mutex;
static nxt_thread_cond_t nxt_app_cond;
diff --git a/src/nxt_application.h b/src/nxt_application.h
index f4865d99..1f9a40e6 100644
--- a/src/nxt_application.h
+++ b/src/nxt_application.h
@@ -307,6 +307,7 @@ nxt_app_msg_read_length(u_char *src, size_t *length)
nxt_app_lang_module_t *nxt_app_lang_module(nxt_runtime_t *rt, nxt_str_t *name);
nxt_app_type_t nxt_app_parse_type(u_char *p, size_t length);
+NXT_EXPORT extern nxt_str_t nxt_server;
extern nxt_application_module_t nxt_go_module;
diff --git a/src/nxt_controller.c b/src/nxt_controller.c
index 17627e83..8c098efc 100644
--- a/src/nxt_controller.c
+++ b/src/nxt_controller.c
@@ -1265,7 +1265,7 @@ nxt_controller_response(nxt_task_t *task, nxt_controller_request_t *req,
body->mem.free = nxt_cpymem(body->mem.free, "\r\n", 2);
size = sizeof("HTTP/1.1 " "\r\n") - 1 + status_line.length
- + sizeof("Server: Unit/" NXT_VERSION "\r\n") - 1
+ + sizeof("Server: " NXT_SERVER "\r\n") - 1
+ sizeof("Date: Wed, 31 Dec 1986 16:40:00 GMT\r\n") - 1
+ sizeof("Content-Type: application/json\r\n") - 1
+ sizeof("Content-Length: " "\r\n") - 1 + NXT_SIZE_T_LEN
@@ -1287,7 +1287,7 @@ nxt_controller_response(nxt_task_t *task, nxt_controller_request_t *req,
status_line.length);
nxt_str_set(&str, "\r\n"
- "Server: Unit/" NXT_VERSION "\r\n"
+ "Server: " NXT_SERVER "\r\n"
"Date: ");
b->mem.free = nxt_cpymem(b->mem.free, str.start, str.length);
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c
index 02075b19..9fc4a0e1 100644
--- a/src/nxt_http_request.c
+++ b/src/nxt_http_request.c
@@ -297,7 +297,7 @@ nxt_http_request_header_send(nxt_task_t *task, nxt_http_request_t *r)
goto fail;
}
- nxt_http_field_set(server, "Server", "Unit/" NXT_VERSION);
+ nxt_http_field_set(server, "Server", NXT_SERVER);
if (r->resp.date == NULL) {
date = nxt_list_zero_add(r->resp.fields);
diff --git a/src/nxt_main.h b/src/nxt_main.h
index df74a5eb..19f084d3 100644
--- a/src/nxt_main.h
+++ b/src/nxt_main.h
@@ -14,6 +14,7 @@
#define NXT_VERSION "1.2"
#define NXT_VERNUM 10200
+#define NXT_SERVER "Unit/" NXT_VERSION
typedef struct nxt_port_s nxt_port_t;
typedef struct nxt_task_s nxt_task_t;
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index a7bfaac2..5a4dfe64 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -668,6 +668,8 @@ nxt_php_register_variables(zval *track_vars_array TSRMLS_DC)
php_register_variable_safe((char *) (n), (char *) (v).start, \
(v).length, track_vars_array TSRMLS_CC) \
+ NXT_PHP_SET("SERVER_SOFTWARE", nxt_server);
+
NXT_PHP_SET("SERVER_PROTOCOL", h->version);
/*
diff --git a/src/nxt_python_wsgi.c b/src/nxt_python_wsgi.c
index df3aa1c3..49063ae9 100644
--- a/src/nxt_python_wsgi.c
+++ b/src/nxt_python_wsgi.c
@@ -541,6 +541,24 @@ nxt_python_create_environ(nxt_task_t *task)
return NULL;
}
+ obj = PyString_FromStringAndSize((char *) nxt_server.start,
+ nxt_server.length);
+ if (nxt_slow_path(obj == NULL)) {
+ nxt_alert(task,
+ "Python failed to create the \"SERVER_SOFTWARE\" environ value");
+ goto fail;
+ }
+
+ if (nxt_slow_path(PyDict_SetItemString(environ, "SERVER_SOFTWARE", obj)
+ != 0))
+ {
+ nxt_alert(task,
+ "Python failed to set the \"SERVER_SOFTWARE\" environ value");
+ goto fail;
+ }
+
+ Py_DECREF(obj);
+
obj = Py_BuildValue("(ii)", 1, 0);
if (nxt_slow_path(obj == NULL)) {
diff --git a/src/perl/nxt_perl_psgi.c b/src/perl/nxt_perl_psgi.c
index 5b206cba..16bcf79f 100644
--- a/src/perl/nxt_perl_psgi.c
+++ b/src/perl/nxt_perl_psgi.c
@@ -596,6 +596,9 @@ nxt_perl_psgi_env_create(PerlInterpreter *my_perl, nxt_task_t *task,
RC(nxt_perl_psgi_read_add_env(my_perl, task, rmsg, \
hash_env, ATTR, &str))
+ RC(nxt_perl_psgi_env_append_str(my_perl, hash_env,
+ "SERVER_SOFTWARE", &nxt_server));
+
GET_STR("REQUEST_METHOD");
GET_STR("REQUEST_URI");
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c
index 6785d031..230c5b98 100644
--- a/src/ruby/nxt_ruby.c
+++ b/src/ruby/nxt_ruby.c
@@ -272,6 +272,11 @@ nxt_ruby_rack_env_create(VALUE arg)
VALUE hash_env, version;
hash_env = rb_hash_new();
+
+ rb_hash_aset(hash_env, rb_str_new2("SERVER_SOFTWARE"),
+ rb_str_new((const char *) nxt_server.start,
+ (long) nxt_server.length));
+
version = rb_ary_new();
rb_ary_push(version, UINT2NUM(NXT_RUBY_RACK_API_VERSION_MAJOR));