You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2008/09/28 12:00:31 UTC
svn commit: r699794 -
/tomcat/connectors/branches/other/jk_isapi_plugin_chunked/jk/native/iis/jk_isapi_plugin.c
Author: rjung
Date: Sun Sep 28 03:00:30 2008
New Revision: 699794
URL: http://svn.apache.org/viewvc?rev=699794&view=rev
Log:
Add configurable error page redirect.
Disabled by default, you need to define
CONFIGURABLE_ERROR_PAGE and then set the
redirect URL via error_page.
Modified:
tomcat/connectors/branches/other/jk_isapi_plugin_chunked/jk/native/iis/jk_isapi_plugin.c
Modified: tomcat/connectors/branches/other/jk_isapi_plugin_chunked/jk/native/iis/jk_isapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/branches/other/jk_isapi_plugin_chunked/jk/native/iis/jk_isapi_plugin.c?rev=699794&r1=699793&r2=699794&view=diff
==============================================================================
--- tomcat/connectors/branches/other/jk_isapi_plugin_chunked/jk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/connectors/branches/other/jk_isapi_plugin_chunked/jk/native/iis/jk_isapi_plugin.c Sun Sep 28 03:00:30 2008
@@ -56,12 +56,20 @@
#else
#define HAS_CHUNKING "-NO_CHUNKING"
#endif
+
#ifdef AUTOMATIC_POOL_SIZE
#define HAS_AUTO_POOL "-AUTO_POOL"
#else
#define HAS_AUTO_POOL "-NO_AUTO_POOL"
#endif
-#define VERSION_STRING "Jakarta/ISAPI/" JK_EXPOSED_VERSION HAS_CHUNKING HAS_AUTO_POOL
+
+#ifdef CONFIGURABLE_ERROR_PAGE
+#define HAS_ERROR_PAGE "-ERROR_PAGE"
+#else
+#define HAS_ERROR_PAGE "-NO_ERROR_PAGE"
+#endif
+
+#define VERSION_STRING "Jakarta/ISAPI/" JK_EXPOSED_VERSION HAS_CHUNKING HAS_AUTO_POOL HAS_ERROR_PAGE
#define SHM_DEF_NAME "JKISAPISHMEM"
#define DEFAULT_WORKER_NAME ("ajp13")
@@ -129,6 +137,10 @@
#define REJECT_UNSAFE_TAG ("reject_unsafe")
#define WATCHDOG_INTERVAL_TAG ("watchdog_interval")
#define ENABLE_CHUNKED_ENCODING_TAG ("enable_chunked_encoding")
+#ifdef CONFIGURABLE_ERROR_PAGE
+#define ERROR_PAGE_TAG ("error_page")
+#endif
+
/* HTTP standard headers */
#define TRANSFER_ENCODING_CHUNKED_HEADER_COMPLETE ("Transfer-Encoding: chunked")
#define TRANSFER_ENCODING_CHUNKED_HEADER_COMPLETE_LEN (26)
@@ -254,6 +266,10 @@
static int reject_unsafe = 0;
static int watchdog_interval = 0;
static HANDLE watchdog_handle = NULL;
+#ifdef CONFIGURABLE_ERROR_PAGE
+static char error_page_buf[INTERNET_MAX_URL_LENGTH] = {0};
+static char *error_page = NULL;
+#endif
#define URI_SELECT_OPT_PARSED 0
#define URI_SELECT_OPT_UNPARSED 1
@@ -1893,8 +1909,28 @@
jk_log(logger, JK_LOG_ERROR,
"service() failed with http error %d", is_error);
}
- lpEcb->dwHttpStatusCode = is_error;
- write_error_message(lpEcb, is_error);
+#ifdef CONFIGURABLE_ERROR_PAGE
+ /** Try to redirect the client to a page explaining the ISAPI redirector is down */
+ if (error_page) {
+ int len_of_error_page = (int)strlen(error_page);
+ if (!lpEcb->ServerSupportFunction(lpEcb->ConnID,
+ HSE_REQ_SEND_URL_REDIRECT_RESP,
+ error_page,
+ (LPDWORD)&len_of_error_page,
+ (LPDWORD)NULL)) {
+ jk_log(logger, JK_LOG_ERROR,
+ "HttpExtensionProc error, Error page redirect failed with %d (0x%08x)",
+ GetLastError(), GetLastError());
+ lpEcb->dwHttpStatusCode = is_error;
+ }
+ }
+ else {
+#endif
+ lpEcb->dwHttpStatusCode = is_error;
+ write_error_message(lpEcb, is_error);
+#ifdef CONFIGURABLE_ERROR_PAGE
+ }
+#endif
}
e->done(&e, logger);
}
@@ -2220,6 +2256,11 @@
"SF_NOTIFY_PREPROC_HEADERS" : "UNKNOWN"),
iis_info.filter_notify_event);
+#ifdef CONFIGURABLE_ERROR_PAGE
+ if (error_page) {
+ jk_log(logger, JK_LOG_DEBUG, "Using error page '%s'.", error_page);
+ }
+#endif
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);
@@ -2427,6 +2468,11 @@
#ifdef ALLOW_CHUNKING
chunked_encoding_enabled = get_config_bool(src, ENABLE_CHUNKED_ENCODING_TAG, JK_FALSE);
#endif
+#ifdef CONFIGURABLE_ERROR_PAGE
+ if (get_config_parameter(src, ERROR_PAGE_TAG, error_page_buf, sizeof(error_page_buf))) {
+ error_page = error_page_buf;
+ }
+#endif
if (using_ini_file) {
jk_map_free(&map);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org