ASF Bugzilla – Attachment 16478 Details for
Bug 35298
Multiple JK/ISAPI redirectors on a single IIS site are not supported
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes for Tomcat Header Handling
Tomcat Headers.patch (text/plain), 9.29 KB, created by
Tim Whittington
on 2005-09-21 04:03:19 UTC
(
hide
)
Description:
Fixes for Tomcat Header Handling
Filename:
MIME Type:
Creator:
Tim Whittington
Created:
2005-09-21 04:03:19 UTC
Size:
9.29 KB
patch
obsolete
>? jk/native/apache-2.0/Release >? jk/native/iis/Release >? jk/native/iis/isapi.vcproj >? jk/native/iis/isapi_redirect.properties >Index: jk/native/iis/jk_isapi_plugin.c >=================================================================== >RCS file: /home/cvspublic/jakarta-tomcat-connectors/jk/native/iis/jk_isapi_plugin.c,v >retrieving revision 1.53 >diff -u -r1.53 jk_isapi_plugin.c >--- jk/native/iis/jk_isapi_plugin.c 14 Sep 2005 10:52:43 -0000 1.53 >+++ jk/native/iis/jk_isapi_plugin.c 21 Sep 2005 01:58:10 -0000 >@@ -55,22 +55,26 @@ > #define QUERY_HEADER_NAME_BASE ("TOMCATQUERY") > #define WORKER_HEADER_NAME_BASE ("TOMCATWORKER") > #define TOMCAT_TRANSLATE_HEADER_NAME_BASE ("TOMCATTRANSLATE") >-#define CONTENT_LENGTH ("CONTENT_LENGTH:") >-/* The template used to construct our unique headers >- * from the base name and module instance >- */ >-#define HEADER_TEMPLATE ("%s%p:") >-#define HTTP_HEADER_TEMPLATE ("HTTP_%s%p") > > static char URI_HEADER_NAME[_MAX_FNAME]; > static char QUERY_HEADER_NAME[_MAX_FNAME]; > static char WORKER_HEADER_NAME[_MAX_FNAME]; > static char TOMCAT_TRANSLATE_HEADER_NAME[_MAX_FNAME]; > >+/** The variants of the special headers after IIS adds HTTP_ to the front of them */ > static char HTTP_URI_HEADER_NAME[_MAX_FNAME]; > static char HTTP_QUERY_HEADER_NAME[_MAX_FNAME]; > static char HTTP_WORKER_HEADER_NAME[_MAX_FNAME]; > >+/* The templates used to construct our unique headers >+ from the base name and module instance >+ i.e. X_HEADER_NAME_BASE_<DLL Handle>: */ >+#define HEADER_TEMPLATE ("%s%p:") >+/* The HTTP_ form of the header for use in ExtensionProc */ >+#define HTTP_HEADER_PREFIX ("HTTP_") >+#define HTTP_HEADER_PREFIX_LEN (5) >+#define HTTP_HEADER_TEMPLATE ("HTTP_%s") >+ > #define REGISTRY_LOCATION ("Software\\Apache Software Foundation\\Jakarta Isapi Redirector\\1.0") > #define EXTENSION_URI_TAG ("extension_uri") > >@@ -79,6 +83,14 @@ > #define URI_SELECT_UNPARSED_VERB ("unparsed") > #define URI_SELECT_ESCAPED_VERB ("escaped") > >+#define CONTENT_LENGTH_HEADER ("Content-Length:") >+#define CONTENT_LENGTH_HEADER_NAME ("Content-Length") >+#define CONTENT_LENGTH_HEADER_NAME_LEN (14) >+ >+#define TRANSLATE_HEADER ("Translate:") >+#define TRANSLATE_HEADER_NAME ("Translate") >+#define TRANSLATE_HEADER_NAME_LC ("translate") >+ > #define BAD_REQUEST -1 > #define BAD_PATH -2 > #define MAX_SERVERNAME 128 >@@ -125,6 +137,10 @@ > (place) = def; \ > } } while(0) > >+/* HTTP protocol CRLF */ >+static char CRLF[3] = { (char)13, (char)10, '\0' }; >+#define CRLF_LEN (2) >+ > static char ini_file_name[MAX_PATH]; > static int using_ini_file = JK_FALSE; > static int is_inited = JK_FALSE; >@@ -480,8 +496,6 @@ > const char *const *header_values, > unsigned int num_of_headers) > { >- static char crlf[3] = { (char)13, (char)10, '\0' }; >- > JK_TRACE_ENTER(logger); > if (status < 100 || status > 1000) { > jk_log(logger, JK_LOG_ERROR, >@@ -529,12 +543,12 @@ > strcat(headers_str, header_names[i]); > strcat(headers_str, ": "); > strcat(headers_str, header_values[i]); >- strcat(headers_str, crlf); >+ strcat(headers_str, CRLF); > } >- strcat(headers_str, crlf); >+ strcat(headers_str, CRLF); > } > else { >- headers_str = crlf; >+ headers_str = CRLF; > } > > if (!p->lpEcb->ServerSupportFunction(p->lpEcb->ConnID, >@@ -907,7 +921,7 @@ > * This allows the servlet to handle 'Translate: f'. > */ > if (GetHeader >- (pfc, "Translate:", (LPVOID) Translate, >+ (pfc, TRANSLATE_HEADER, (LPVOID) Translate, > (LPDWORD) & szTranslate) && Translate != NULL > && szTranslate > 0) { > if (!AddHeader >@@ -1109,13 +1123,14 @@ > sprintf(URI_HEADER_NAME, HEADER_TEMPLATE, URI_HEADER_NAME_BASE, hInst); > sprintf(QUERY_HEADER_NAME, HEADER_TEMPLATE, QUERY_HEADER_NAME_BASE, hInst); > sprintf(WORKER_HEADER_NAME, HEADER_TEMPLATE, WORKER_HEADER_NAME_BASE, hInst); >- sprintf(TOMCAT_TRANSLATE_HEADER_NAME, HEADER_TEMPLATE, TOMCAT_TRANSLATE_HEADER_NAME_BASE, hInst); >- >- sprintf(HTTP_URI_HEADER_NAME, HTTP_HEADER_TEMPLATE, URI_HEADER_NAME_BASE, hInst); >- sprintf(HTTP_QUERY_HEADER_NAME, HTTP_HEADER_TEMPLATE, QUERY_HEADER_NAME_BASE, hInst); >- sprintf(HTTP_WORKER_HEADER_NAME, HTTP_HEADER_TEMPLATE, WORKER_HEADER_NAME_BASE, hInst); >+ sprintf(TOMCAT_TRANSLATE_HEADER_NAME, HEADER_TEMPLATE, >+ TOMCAT_TRANSLATE_HEADER_NAME_BASE, hInst); > >- break; >+ /* Construct the HTTP_ headers that will be seen in ExtensionProc */ >+ sprintf(HTTP_URI_HEADER_NAME, HTTP_HEADER_TEMPLATE, URI_HEADER_NAME); >+ sprintf(HTTP_QUERY_HEADER_NAME, HTTP_HEADER_TEMPLATE, QUERY_HEADER_NAME); >+ sprintf(HTTP_WORKER_HEADER_NAME, HTTP_HEADER_TEMPLATE, WORKER_HEADER_NAME); >+ break; > case DLL_PROCESS_DETACH: > __try { > TerminateFilter(HSE_TERM_MUST_UNLOAD); >@@ -1163,6 +1178,12 @@ > jk_log(logger, JK_LOG_DEBUG, "Using worker mount file %s.", > worker_mount_file); > jk_log(logger, JK_LOG_DEBUG, "Using uri select %d.", uri_select_option); >+ >+ jk_log(logger, JK_LOG_DEBUG, "Using uri header %s.", URI_HEADER_NAME); >+ jk_log(logger, JK_LOG_DEBUG, "Using query header %s.", QUERY_HEADER_NAME); >+ jk_log(logger, JK_LOG_DEBUG, "Using worker header %s.", WORKER_HEADER_NAME); >+ jk_log(logger, JK_LOG_DEBUG, "Using translate header %s.", TOMCAT_TRANSLATE_HEADER_NAME); >+ > } > if (uri_worker_map_alloc(&uw_map, NULL, logger)) { > rc = JK_FALSE; >@@ -1522,10 +1543,10 @@ > if (cnt) { > char *headers_buf = jk_pool_strdup(&private_data->p, huge_buf); > unsigned int i; >- size_t len_of_http_prefix = strlen("HTTP_"); >+ size_t len_of_http_prefix = HTTP_HEADER_PREFIX_LEN; > BOOL need_content_length_header = (s->content_length == 0); > >- cnt -= 2; /* For our two special headers */ >+ cnt -= 2; /* For our two special headers (URI,WORKER. QUERY is optional)*/ > /* allocate an extra header slot in case we need to add a content-length header */ > s->headers_names = > jk_pool_alloc(&private_data->p, (cnt + 1) * sizeof(char *)); >@@ -1539,24 +1560,28 @@ > for (i = 0, tmp = headers_buf; *tmp && i < cnt;) { > int real_header = JK_TRUE; > >- /* Skipp the HTTP_ prefix to the beginning of th header name */ >+ /* Skip the HTTP_ prefix to the beginning of the header name */ > tmp += len_of_http_prefix; > > if (!strnicmp(tmp, URI_HEADER_NAME, strlen(URI_HEADER_NAME)) >- || !strnicmp(tmp, WORKER_HEADER_NAME, >- strlen(WORKER_HEADER_NAME))) { >+ || !strnicmp(tmp, WORKER_HEADER_NAME, strlen(WORKER_HEADER_NAME)) ) { >+ /* Skip redirector headers */ >+ real_header = JK_FALSE; >+ } >+ if (!strnicmp(tmp, QUERY_HEADER_NAME, strlen(QUERY_HEADER_NAME))) { >+ /* QUERY was supplied, remove it from the count and skip */ >+ cnt--; > real_header = JK_FALSE; > } > else if (need_content_length_header && >- !strnicmp(tmp, CONTENT_LENGTH, >- strlen(CONTENT_LENGTH))) { >+ !strnicmp(tmp, CONTENT_LENGTH_HEADER_NAME, >+ CONTENT_LENGTH_HEADER_NAME_LEN)) { > need_content_length_header = FALSE; > s->headers_names[i] = tmp; > } > else if (!strnicmp(tmp, TOMCAT_TRANSLATE_HEADER_NAME, > strlen(TOMCAT_TRANSLATE_HEADER_NAME))) { >- tmp += 6; /* TOMCAT */ >- s->headers_names[i] = tmp; >+ s->headers_names[i] = TRANSLATE_HEADER_NAME_LC; > } > else { > s->headers_names[i] = tmp; >@@ -1574,7 +1599,7 @@ > *tmp = '\0'; > tmp++; > >- /* Skip all the WS chars after the ':' to the beginning of th header value */ >+ /* Skip all the WS chars after the ':' to the beginning of the header value */ > while (' ' == *tmp || '\t' == *tmp || '\v' == *tmp) { > tmp++; > } >@@ -1589,7 +1614,7 @@ > *tmp = '\0'; > tmp++; > >- /* skipp CR LF */ >+ /* skip CR LF */ > while (*tmp == '\n' || *tmp == '\r') { > tmp++; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 35298
:
15583
|
16478
|
16484