Il giorno 30/nov/2011, alle ore 14:04, steve ha scritto:
> Hi,
>
> Here is a patch for http://projects.unbit.it/uwsgi/ticket/58
>
> cheers,
> - steve
Seems good, i only need to enforce the default to "true".
Can you give me your name and surname to put them in the credits ?
>
> ------------------------------------------------------------
>
> diff --git a/apache2/mod_uwsgi.c b/apache2/mod_uwsgi.c
> index 78e3fea..1a647e9 100644
> --- a/apache2/mod_uwsgi.c
> +++ b/apache2/mod_uwsgi.c
> @@ -72,6 +72,7 @@ typedef struct {
> char script_name[256];
> char scheme[9];
> int cgi_mode ;
> + int empty_remote_user;
> int max_vars;
> } uwsgi_cfg;
> @@ -162,6 +163,7 @@ static void *uwsgi_server_config(apr_pool_t *p,
> server_rec *s) {
> c->cgi_mode = 0 ;
> c->max_vars = 128;
> c->script_name[0] = 0;
> + c->empty_remote_user = 1;
> return c;
> }
> @@ -176,6 +178,7 @@ static void *uwsgi_dir_config(apr_pool_t *p, char *dir) {
> c->modifier1 = 0 ;
> c->modifier2 = 0 ;
> c->cgi_mode = 0 ;
> + c->empty_remote_user = 1 ;
> c->max_vars = 128;
> c->script_name[0] = 0;
> if (dir) {
> @@ -344,7 +347,9 @@ static int uwsgi_handler(request_rec *r) {
> vecptr = uwsgi_add_var(uwsgi_vars, vecptr, r, "SERVER_PROTOCOL",
> r->protocol, &pkt_size) ;
> vecptr = uwsgi_add_var(uwsgi_vars, vecptr, r, "REQUEST_URI",
> r->unparsed_uri, &pkt_size) ;
> vecptr = uwsgi_add_var(uwsgi_vars, vecptr, r, "REMOTE_ADDR",
> r->connection->remote_ip, &pkt_size) ;
> - vecptr = uwsgi_add_var(uwsgi_vars, vecptr, r, "REMOTE_USER", r->user ?
> r->user : "", &pkt_size) ;
> + if (c->empty_remote_user) {
> + vecptr = uwsgi_add_var(uwsgi_vars, vecptr, r, "REMOTE_USER",
> r->user ? r->user : "", &pkt_size);
> + }
> if (r->user) {
> vecptr = uwsgi_add_var(uwsgi_vars, vecptr, r, "AUTH_TYPE",
> (char *) ap_auth_type(r), &pkt_size) ;
> }
> @@ -722,6 +727,25 @@ static const char * cmd_uwsgi_socket(cmd_parms *cmd,
> void *cfg, const char *path
> return NULL ;
> }
> +static const char * cmd_uwsgi_empty_remote_user(cmd_parms *cmd, void *cfg,
> const char *value) {
> +
> + uwsgi_cfg *c ;
> +
> + if (cfg) {
> + c = cfg ;
> + }
> + else {
> + c = ap_get_module_config(cmd->server->module_config,
> &uwsgi_module);
> + }
> +
> + if (!strcmp("yes", value) || !strcmp("on", value) || !strcmp("enable",
> value) || !strcmp("1", value)) {
> + c->empty_remote_user = 1 ;
> + }
> +
> + return NULL ;
> +
> +}
> +
> static const command_rec uwsgi_cmds[] = {
> AP_INIT_TAKE12("uWSGIsocket", cmd_uwsgi_socket, NULL,
> RSRC_CONF|ACCESS_CONF, "Absolute path and optional timeout in seconds of
> uwsgi server socket"),
> AP_INIT_TAKE1("uWSGIsocket2", cmd_uwsgi_socket2, NULL,
> RSRC_CONF|ACCESS_CONF, "Absolute path of failover uwsgi server socket"),
> @@ -730,7 +754,8 @@ static const command_rec uwsgi_cmds[] = {
> AP_INIT_TAKE1("uWSGIforceScriptName", cmd_uwsgi_force_script_name,
> NULL, ACCESS_CONF, "Fix for PATH_INFO/SCRIPT_NAME when the location has
> filesystem correspondence"),
> AP_INIT_TAKE1("uWSGIforceCGImode", cmd_uwsgi_force_cgi_mode, NULL,
> ACCESS_CONF, "Force uWSGI CGI mode for perfect integration with apache
> filter"),
> AP_INIT_TAKE1("uWSGIforceWSGIscheme", cmd_uwsgi_force_wsgi_scheme,
> NULL, ACCESS_CONF, "Force the WSGI scheme var (set by default to \"http\")"),
>
> - AP_INIT_TAKE1("uWSGImaxVars", cmd_uwsgi_max_vars, NULL, ACCESS_CONF,
> "Set the maximum allowed number of uwsgi variables (default 128)"),
> + AP_INIT_TAKE1("uWSGImaxVars", cmd_uwsgi_max_vars, NULL, ACCESS_CONF,
> "Set the maximum allowed number of uwsgi variables (default 128)"),
> + AP_INIT_TAKE1("uWSGIEmptyRemoteUser", cmd_uwsgi_empty_remote_user,
> NULL, ACCESS_CONF, "Always include REMOTE_USER in the environment, even with
> an empty value"),
> {NULL}
> };
>
> ------------------------------------------------------------
> --
> random spiel: http://lonetwin.net/
> what i'm stumbling into: http://lonetwin.stumbleupon.com/
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
--
Roberto De Ioris
http://unbit.it
JID: [email protected]
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi