|
|
c7d01a6 |
|
|
|
c7d01a6 |
http://code.google.com/p/modwsgi/source/detail?r=8906fb52b6b23455320c848216f6120c979e57f5
|
|
|
c7d01a6 |
http://code.google.com/p/modwsgi/source/detail?r=25deb4b94536c96d63505b2a6d4dfb5be1b38195
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
diff -r 21f4dac5959a -r 8906fb52b6b2 mod_wsgi/mod_wsgi.c
|
|
|
c7d01a6 |
--- mod_wsgi-3.3/mod_wsgi.c.httpd24
|
|
|
c7d01a6 |
+++ mod_wsgi-3.3/mod_wsgi.c
|
|
|
c7d01a6 |
@@ -193,6 +193,9 @@ static PyTypeObject Auth_Type;
|
|
|
c7d01a6 |
#endif
|
|
|
c7d01a6 |
#if AP_MODULE_MAGIC_AT_LEAST(20060110,0)
|
|
|
c7d01a6 |
#define MOD_WSGI_WITH_AUTHZ_PROVIDER 1
|
|
|
c7d01a6 |
+#if AP_MODULE_MAGIC_AT_LEAST(20100919,0)
|
|
|
c7d01a6 |
+#define MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED 1
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
#endif
|
|
|
c7d01a6 |
#endif
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
@@ -5637,7 +5640,7 @@ static void wsgi_python_version(void)
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
-static apr_status_t wsgi_python_term()
|
|
|
c7d01a6 |
+static apr_status_t wsgi_python_term(void)
|
|
|
c7d01a6 |
{
|
|
|
c7d01a6 |
PyInterpreterState *interp = NULL;
|
|
|
c7d01a6 |
PyThreadState *tstate = NULL;
|
|
|
c7d01a6 |
@@ -7851,6 +7854,7 @@ static const char *wsgi_set_auth_group_s
|
|
|
c7d01a6 |
return NULL;
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
+#if !defined(MOD_WSGI_WITH_AUTHN_PROVIDER)
|
|
|
c7d01a6 |
static const char *wsgi_set_user_authoritative(cmd_parms *cmd, void *mconfig,
|
|
|
c7d01a6 |
const char *f)
|
|
|
c7d01a6 |
{
|
|
|
c7d01a6 |
@@ -7866,6 +7870,7 @@ static const char *wsgi_set_user_authori
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
return NULL;
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
static const char *wsgi_set_group_authoritative(cmd_parms *cmd, void *mconfig,
|
|
|
c7d01a6 |
const char *f)
|
|
|
c7d01a6 |
@@ -10092,6 +10097,17 @@ static void wsgi_process_socket(apr_pool
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
apr_sockaddr_ip_get(&c->local_ip, c->local_addr);
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0)
|
|
|
c7d01a6 |
+ if ((rv = apr_socket_addr_get(&c->client_addr, APR_REMOTE, sock))
|
|
|
c7d01a6 |
+ != APR_SUCCESS) {
|
|
|
c7d01a6 |
+ ap_log_error(APLOG_MARK, APLOG_INFO, rv, wsgi_server,
|
|
|
c7d01a6 |
+ "mod_wsgi (pid=%d): Failed call "
|
|
|
c7d01a6 |
+ "apr_socket_addr_get(APR_REMOTE).", getpid());
|
|
|
c7d01a6 |
+ apr_socket_close(sock);
|
|
|
c7d01a6 |
+ return;
|
|
|
c7d01a6 |
+ }
|
|
|
c7d01a6 |
+ apr_sockaddr_ip_get(&c->client_ip, c->client_addr);
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
if ((rv = apr_socket_addr_get(&c->remote_addr, APR_REMOTE, sock))
|
|
|
c7d01a6 |
!= APR_SUCCESS) {
|
|
|
c7d01a6 |
ap_log_error(APLOG_MARK, WSGI_LOG_INFO(rv), wsgi_server,
|
|
|
c7d01a6 |
@@ -10101,6 +10117,7 @@ static void wsgi_process_socket(apr_pool
|
|
|
c7d01a6 |
return;
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
apr_sockaddr_ip_get(&c->remote_ip, c->remote_addr);
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
c->base_server = daemon->group->server;
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
@@ -10183,7 +10200,7 @@ static apr_status_t wsgi_worker_acquire(
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
-static apr_status_t wsgi_worker_release()
|
|
|
c7d01a6 |
+static apr_status_t wsgi_worker_release(void)
|
|
|
c7d01a6 |
{
|
|
|
c7d01a6 |
WSGIThreadStack *stack = wsgi_worker_stack;
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
@@ -10232,7 +10249,7 @@ static apr_status_t wsgi_worker_release(
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
-static apr_status_t wsgi_worker_shutdown()
|
|
|
c7d01a6 |
+static apr_status_t wsgi_worker_shutdown(void)
|
|
|
c7d01a6 |
{
|
|
|
c7d01a6 |
int i;
|
|
|
c7d01a6 |
apr_status_t rv;
|
|
|
4851791 |
@@ -11008,8 +11025,9 @@ static int wsgi_start_process(apr_pool_t
|
|
|
4851791 |
* shared memory segments or memory mapped files not
|
|
|
4851791 |
* available to code in daemon processes.
|
|
|
4851791 |
*/
|
|
|
4851791 |
-
|
|
|
4851791 |
+#if !AP_MODULE_MAGIC_AT_LEAST(20071023, 0)
|
|
|
4851791 |
ap_cleanup_scoreboard(0);
|
|
|
4851791 |
+#endif
|
|
|
4851791 |
|
|
|
4851791 |
/*
|
|
|
4851791 |
* Wipe out random value used in magic token so that not
|
|
|
4851791 |
@@ -12739,8 +12757,13 @@ static int wsgi_hook_daemon_handler(conn
|
|
|
c7d01a6 |
* file for the host.
|
|
|
c7d01a6 |
*/
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0)
|
|
|
c7d01a6 |
+ r->connection->client_ip = (char *)apr_table_get(r->subprocess_env,
|
|
|
c7d01a6 |
+ "REMOTE_ADDR");
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
r->connection->remote_ip = (char *)apr_table_get(r->subprocess_env,
|
|
|
c7d01a6 |
"REMOTE_ADDR");
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
key = apr_psprintf(p, "%s|%s",
|
|
|
c7d01a6 |
apr_table_get(r->subprocess_env,
|
|
|
4851791 |
@@ -13259,6 +13282,18 @@ static PyObject *Auth_environ(AuthObject
|
|
|
c7d01a6 |
Py_DECREF(object);
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0)
|
|
|
c7d01a6 |
+ if (r->useragent_ip) {
|
|
|
c7d01a6 |
+ value = r->useragent_ip;
|
|
|
c7d01a6 |
+#if PY_MAJOR_VERSION >= 3
|
|
|
c7d01a6 |
+ object = PyUnicode_DecodeLatin1(value, strlen(value), NULL);
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
+ object = PyString_FromString(value);
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
+ PyDict_SetItemString(vars, "REMOTE_ADDR", object);
|
|
|
c7d01a6 |
+ Py_DECREF(object);
|
|
|
c7d01a6 |
+ }
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
if (c->remote_ip) {
|
|
|
c7d01a6 |
value = c->remote_ip;
|
|
|
c7d01a6 |
#if PY_MAJOR_VERSION >= 3
|
|
|
4851791 |
@@ -13269,6 +13304,7 @@ static PyObject *Auth_environ(AuthObject
|
|
|
c7d01a6 |
PyDict_SetItemString(vars, "REMOTE_ADDR", object);
|
|
|
c7d01a6 |
Py_DECREF(object);
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
#if PY_MAJOR_VERSION >= 3
|
|
|
c7d01a6 |
value = ap_document_root(r);
|
|
|
4851791 |
@@ -13292,6 +13328,17 @@ static PyObject *Auth_environ(AuthObject
|
|
|
c7d01a6 |
Py_DECREF(object);
|
|
|
c7d01a6 |
}
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0)
|
|
|
c7d01a6 |
+ rport = c->client_addr->port;
|
|
|
c7d01a6 |
+ value = apr_itoa(r->pool, rport);
|
|
|
c7d01a6 |
+#if PY_MAJOR_VERSION >= 3
|
|
|
c7d01a6 |
+ object = PyUnicode_DecodeLatin1(value, strlen(value), NULL);
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
+ object = PyString_FromString(value);
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
+ PyDict_SetItemString(vars, "REMOTE_PORT", object);
|
|
|
c7d01a6 |
+ Py_DECREF(object);
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
rport = c->remote_addr->port;
|
|
|
c7d01a6 |
value = apr_itoa(r->pool, rport);
|
|
|
c7d01a6 |
#if PY_MAJOR_VERSION >= 3
|
|
|
4851791 |
@@ -13301,6 +13348,7 @@ static PyObject *Auth_environ(AuthObject
|
|
|
c7d01a6 |
#endif
|
|
|
c7d01a6 |
PyDict_SetItemString(vars, "REMOTE_PORT", object);
|
|
|
c7d01a6 |
Py_DECREF(object);
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
value = r->protocol;
|
|
|
c7d01a6 |
#if PY_MAJOR_VERSION >= 3
|
|
|
4851791 |
@@ -14391,8 +14439,13 @@ static int wsgi_hook_access_checker(requ
|
|
|
c7d01a6 |
host = ap_get_remote_host(r->connection, r->per_dir_config,
|
|
|
c7d01a6 |
REMOTE_HOST, NULL);
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
+#if AP_MODULE_MAGIC_AT_LEAST(20111130,0)
|
|
|
c7d01a6 |
+ if (!host)
|
|
|
c7d01a6 |
+ host = r->useragent_ip;
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
if (!host)
|
|
|
c7d01a6 |
host = r->connection->remote_ip;
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
allow = wsgi_allow_access(r, config, host);
|
|
|
c7d01a6 |
|
|
|
4851791 |
@@ -14645,8 +14698,14 @@ static int wsgi_hook_check_user_id(reque
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
#if defined(MOD_WSGI_WITH_AUTHZ_PROVIDER)
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
+#if MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED
|
|
|
c7d01a6 |
+static authz_status wsgi_check_authorization(request_rec *r,
|
|
|
c7d01a6 |
+ const char *require_args,
|
|
|
c7d01a6 |
+ const void *parsed_require_line)
|
|
|
c7d01a6 |
+#else
|
|
|
c7d01a6 |
static authz_status wsgi_check_authorization(request_rec *r,
|
|
|
c7d01a6 |
const char *require_args)
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
{
|
|
|
c7d01a6 |
WSGIRequestConfig *config;
|
|
|
c7d01a6 |
|
|
|
4851791 |
@@ -14695,6 +14754,9 @@ static authz_status wsgi_check_authoriza
|
|
|
c7d01a6 |
static const authz_provider wsgi_authz_provider =
|
|
|
c7d01a6 |
{
|
|
|
c7d01a6 |
&wsgi_check_authorization,
|
|
|
c7d01a6 |
+#if MOD_WSGI_WITH_AUTHZ_PROVIDER_PARSED
|
|
|
c7d01a6 |
+ NULL,
|
|
|
c7d01a6 |
+#endif
|
|
|
c7d01a6 |
};
|
|
|
c7d01a6 |
|
|
|
c7d01a6 |
#else
|