From 53ccd3d4b8e4c8ed3e7fa9ba80d758a45106ba68 Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Sun, 17 Oct 2010 12:25:50 +0200 Subject: [PATCH] new option --http-modifer1 --- http.c | 2 +- plugins/mono/mono_plugin.c | 0 plugins/psgi/psgi_plugin.c | 12 ++++++++++++ uwsgi.c | 4 ++++ uwsgi.h | 2 ++ 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 plugins/mono/mono_plugin.c diff --git a/http.c b/http.c index bceb8aff..5834e2ec 100644 --- a/http.c +++ b/http.c @@ -207,7 +207,7 @@ static void *http_request(void *u_h_r) int path_info_len; char *ip; - up[0] = 5; + up[0] = uwsgi.http_modifier1; up[3] = 0; up += 4; diff --git a/plugins/mono/mono_plugin.c b/plugins/mono/mono_plugin.c new file mode 100644 index 00000000..e69de29b diff --git a/plugins/psgi/psgi_plugin.c b/plugins/psgi/psgi_plugin.c index 702188f4..52820132 100644 --- a/plugins/psgi/psgi_plugin.c +++ b/plugins/psgi/psgi_plugin.c @@ -6,6 +6,10 @@ static PerlInterpreter *my_perl; static SV *psgi_func ; +#ifdef UWSGI_THREADING +pthread_key_t uwsgi_perl_interpreter; +#endif + extern char **environ; extern struct uwsgi_server uwsgi; @@ -107,6 +111,14 @@ int uwsgi_init(char *args){ http_sc->message_size = strlen(http_sc->message); } +#ifdef UWSGI_THREADING + if (uwsgi.threads > 1) { + if (pthread_key_create(&uwsgi_perl_interpreter, NULL)) { + uwsgi_error("pthread_key_create()"); + exit(1); + } + } +#endif PL_origalen = 1; perl_parse(my_perl, xs_init, 4, embedding, NULL); diff --git a/uwsgi.c b/uwsgi.c index d90c4db9..565318f9 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -165,6 +165,7 @@ static struct option long_options[] = { {"http", required_argument, 0, LONG_ARGS_HTTP}, {"http-only", no_argument, &uwsgi.http_only, 1}, {"http-var", required_argument, 0, LONG_ARGS_HTTP_VAR}, + {"http-modifier1", required_argument, 0, LONG_ARGS_HTTP_MODIFIER1}, #endif {"catch-exceptions", no_argument, &uwsgi.catch_exceptions, 1}, {"close-on-exec", no_argument, &uwsgi.close_on_exec, 1}, @@ -2210,6 +2211,9 @@ void manage_opt(int i, char *optarg) { uwsgi_log( "you can specify at most 64 --http-var options\n"); } break; + case LONG_ARGS_HTTP_MODIFIER1: + uwsgi.http_modifier1 = (uint8_t) atoi(optarg); + break; #endif #ifdef __linux__ case LONG_ARGS_CGROUP: diff --git a/uwsgi.h b/uwsgi.h index 149b9901..cf5f4c89 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -212,6 +212,7 @@ PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); #define LONG_ARGS_MOUNT 17053 #define LONG_ARGS_THREADS 17054 #define LONG_ARGS_LOG_SENDFILE 17055 +#define LONG_ARGS_HTTP_MODIFIER1 17056 @@ -542,6 +543,7 @@ struct uwsgi_server { int http_fd; char *http_vars[64]; int http_vars_cnt; + uint8_t http_modifier1; #endif int ignore_script_name;