- Fix handling of empty header list entries in http_request_split_value. - Fix access log escaping of " and \\. - Fix digest "md5-sess" implementation (Errata ID 1649, RFC 2617). - Add "AUTH_TYPE" environment (for *cgi), remove fastcgi specific workaround. - Fix splitting :port with IPv6.
63 lines
2.8 KiB
Plaintext
63 lines
2.8 KiB
Plaintext
$OpenBSD: patch-src_mod_fastcgi_c,v 1.9 2012/04/28 09:25:25 sthen Exp $
|
|
|
|
- Add "AUTH_TYPE" environment (for *cgi), remove fastcgi specific workaround.
|
|
- Fix splitting :port with IPv6.
|
|
|
|
--- src/mod_fastcgi.c.orig Mon Apr 23 00:14:54 2012
|
|
+++ src/mod_fastcgi.c Mon Apr 23 00:14:14 2012
|
|
@@ -1857,9 +1857,15 @@ static int fcgi_create_env(server *srv, handler_ctx *h
|
|
|
|
if (con->server_name->used) {
|
|
size_t len = con->server_name->used - 1;
|
|
- char *colon = strchr(con->server_name->ptr, ':');
|
|
- if (colon) len = colon - con->server_name->ptr;
|
|
|
|
+ if (con->server_name->ptr[0] == '[') {
|
|
+ const char *colon = strstr(con->server_name->ptr, "]:");
|
|
+ if (colon) len = (colon + 1) - con->server_name->ptr;
|
|
+ } else {
|
|
+ const char *colon = strchr(con->server_name->ptr, ':');
|
|
+ if (colon) len = colon - con->server_name->ptr;
|
|
+ }
|
|
+
|
|
FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len),con)
|
|
} else {
|
|
#ifdef HAVE_IPV6
|
|
@@ -1910,36 +1916,7 @@ static int fcgi_create_env(server *srv, handler_ctx *h
|
|
FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("REMOTE_ADDR"), s, strlen(s)),con)
|
|
|
|
if (!buffer_is_empty(con->authed_user)) {
|
|
- /* AUTH_TYPE fix by Troy Kruthoff (tkruthoff@gmail.com)
|
|
- * section 4.1.1 of RFC 3875 (cgi spec) requires the server to set a AUTH_TYPE env
|
|
- * declaring the type of authentication used. (see http://tools.ietf.org/html/rfc3875#page-11)
|
|
- *
|
|
- * I copied this code from mod_auth.c where it extracts auth info from the "Authorization"
|
|
- * header to authenticate the user before allowing the request to proceed. I'm guessing it makes
|
|
- * sense to re-parse the header here, as mod_auth is unaware if the request is headed for cgi/fcgi.
|
|
- * Someone more familiar with the lighty internals should be able to quickly determine if we are
|
|
- * better storing AUTH_TYPE on the initial parse in mod_auth.
|
|
- */
|
|
- char *http_authorization = NULL;
|
|
- data_string *ds;
|
|
-
|
|
FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("REMOTE_USER"), CONST_BUF_LEN(con->authed_user)),con)
|
|
-
|
|
- if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "Authorization"))) {
|
|
- http_authorization = ds->value->ptr;
|
|
- }
|
|
-
|
|
- if (ds && ds->value && ds->value->used) {
|
|
- char *auth_realm;
|
|
- if (NULL != (auth_realm = strchr(http_authorization, ' '))) {
|
|
- int auth_type_len = auth_realm - http_authorization;
|
|
- if ((auth_type_len == 5) && (0 == strncmp(http_authorization, "Basic", auth_type_len))) {
|
|
- fcgi_env_add(p->fcgi_env, CONST_STR_LEN("AUTH_TYPE"), CONST_STR_LEN("Basic"));
|
|
- } else if ((auth_type_len == 6) && (0 == strncmp(http_authorization, "Digest", auth_type_len))) {
|
|
- fcgi_env_add(p->fcgi_env, CONST_STR_LEN("AUTH_TYPE"), CONST_STR_LEN("Digest"));
|
|
- }
|
|
- }
|
|
- }
|
|
}
|
|
|
|
if (con->request.content_length > 0 && host->mode != FCGI_AUTHORIZER) {
|