mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-05 16:38:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89158b0509 | ||
|
|
86b90b8b16 | ||
|
|
fe4c88c1c5 |
@@ -7,3 +7,4 @@ b0db39cfad5ac6d4f00bbb3f9c57cf73206e2afb 0.9.5
|
||||
a83e7a482e65befcfbb0e24af8cd5d15190acdd7 0.9.6-rc1
|
||||
b8f67c6cd0d62f864db9b2b265b4e260ad7d873c 0.9.6-rc2
|
||||
35918dd4b3771158b2b57410613ef029e08bbd60 0.9.6
|
||||
5f25d1f97f9dde3e391a668c1c610a52a5db8244 0.9.6.1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
*** september 2010 ***
|
||||
|
||||
* 0.9.6.1 []
|
||||
* 0.9.6.1 [20100912]
|
||||
|
||||
- print the request uri during SIGPIPE or HARAKIRI
|
||||
- added SIGUSR2 support (it will print the current running request, if available)
|
||||
@@ -16,6 +16,10 @@
|
||||
- SNMP agent fix
|
||||
- support for subprocesses generated by master
|
||||
- fix a regression in SCRIPT_NAME handling
|
||||
- Haiku official support
|
||||
- gcc 2.95 support
|
||||
- dynamic app management optimizations
|
||||
- export x-wsgiorg.uwsgi.version in WSGI env
|
||||
|
||||
*** august 2010 ***
|
||||
|
||||
|
||||
@@ -407,9 +407,16 @@ int uwsgi_parse_vars(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req)
|
||||
wsgi_req->pyhome = ptrbuf;
|
||||
wsgi_req->pyhome_len = strsize;
|
||||
}
|
||||
else if (!uwsgi_strncmp("UWSGI_CHDIR", 11, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) {
|
||||
wsgi_req->chdir = ptrbuf;
|
||||
wsgi_req->chdir_len = strsize;
|
||||
}
|
||||
else if (!uwsgi_strncmp("SERVER_NAME", 11, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) {
|
||||
wsgi_req->host = ptrbuf;
|
||||
wsgi_req->host_len = strsize;
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("SERVER_NAME=%.*s\n", wsgi_req->host_len, wsgi_req->host);
|
||||
#endif
|
||||
}
|
||||
else if (!uwsgi_strncmp("HTTPS", 5, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) {
|
||||
wsgi_req->https = ptrbuf;
|
||||
|
||||
@@ -407,6 +407,18 @@ void sanitize_args(struct uwsgi_server *uwsgi) {
|
||||
uwsgi->single_interpreter = 1 ;
|
||||
}
|
||||
|
||||
#ifdef UWSGI_INI
|
||||
if (uwsgi->ini) {
|
||||
uwsgi->single_interpreter = 1 ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UWSGI_PASTE
|
||||
if (uwsgi->paste) {
|
||||
uwsgi->single_interpreter = 1 ;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (uwsgi->shared->options[UWSGI_OPTION_HARAKIRI] > 0) {
|
||||
if (!uwsgi->post_buffering) {
|
||||
uwsgi_log(" *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers *** \n");
|
||||
|
||||
@@ -2036,6 +2036,23 @@ int init_uwsgi_app(PyObject * force_wsgi_dict, PyObject * my_callable) {
|
||||
|
||||
memset(wi, 0, sizeof(struct uwsgi_app));
|
||||
|
||||
// dynamic chdir ?
|
||||
|
||||
if (uwsgi.wsgi_req->chdir_len > 0) {
|
||||
wi->chdir = malloc(uwsgi.wsgi_req->chdir_len + 1);
|
||||
if (wi->chdir == NULL) {
|
||||
uwsgi_error("malloc()");
|
||||
}
|
||||
memcpy(wi->chdir, uwsgi.wsgi_req->chdir, uwsgi.wsgi_req->chdir_len);
|
||||
wi->chdir[uwsgi.wsgi_req->chdir_len] = 0;
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("chdir to %s\n", wi->chdir);
|
||||
#endif
|
||||
if (chdir(wi->chdir)) {
|
||||
uwsgi_error("chdir()");
|
||||
}
|
||||
}
|
||||
|
||||
if (uwsgi.single_interpreter == 0) {
|
||||
wi->interpreter = Py_NewInterpreter();
|
||||
if (!wi->interpreter) {
|
||||
|
||||
@@ -307,6 +307,7 @@ struct uwsgi_app {
|
||||
#endif
|
||||
|
||||
int requests;
|
||||
char *chdir;
|
||||
|
||||
};
|
||||
|
||||
@@ -394,6 +395,9 @@ struct wsgi_request {
|
||||
char *pyhome;
|
||||
uint16_t pyhome_len;
|
||||
|
||||
char *chdir;
|
||||
uint16_t chdir_len;
|
||||
|
||||
int fd_closed;
|
||||
|
||||
int sendfile_fd;
|
||||
|
||||
+12
-1
@@ -145,6 +145,9 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
|
||||
#else
|
||||
PyString_Concat(&zero, PyString_FromString("|"));
|
||||
PyString_Concat(&zero, PyString_FromStringAndSize(wsgi_req->script_name, wsgi_req->script_name_len));
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("VirtualHost SCRIPT_NAME=%s\n", PyString_AsString(zero));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
@@ -155,7 +158,7 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
|
||||
if (PyDict_Contains(uwsgi->py_apps, zero)) {
|
||||
wsgi_req->app_id = PyInt_AsLong(PyDict_GetItem(uwsgi->py_apps, zero));
|
||||
}
|
||||
else if (wsgi_req->script_name_len > 1 || uwsgi->default_app < 0) {
|
||||
else if (wsgi_req->script_name_len > 1 || uwsgi->default_app < 0 || uwsgi->vhost) {
|
||||
/* unavailable app for this SCRIPT_NAME */
|
||||
wsgi_req->app_id = -1;
|
||||
if (wsgi_req->wsgi_script_len > 0 || (wsgi_req->wsgi_callable_len > 0 && wsgi_req->wsgi_module_len > 0)) {
|
||||
@@ -192,6 +195,14 @@ int uwsgi_request_wsgi(struct uwsgi_server *uwsgi, struct wsgi_request *wsgi_req
|
||||
|
||||
// set the interpreter
|
||||
PyThreadState_Swap(wi->interpreter);
|
||||
if (wi->chdir) {
|
||||
#ifdef UWSGI_DEBUG
|
||||
uwsgi_debug("chdir to %s\n", wi->chdir);
|
||||
#endif
|
||||
if (chdir(wi->chdir)) {
|
||||
uwsgi_error("chdir()");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wi->requests++;
|
||||
|
||||
Reference in New Issue
Block a user