int log_unsupported;
int log_to_errlog;
int log_to_query;
+ int fake_async;
} isapi_dir_conf;
typedef struct isapi_loaded isapi_loaded;
dir->log_unsupported = ISAPI_UNDEF;
dir->log_to_errlog = ISAPI_UNDEF;
dir->log_to_query = ISAPI_UNDEF;
+ dir->fake_async = ISAPI_UNDEF;
return dir;
}
dir->log_to_errlog = (add->log_to_errlog == ISAPI_UNDEF)
? base->log_to_errlog
: add->log_to_errlog;
- dir->log_to_query = (add->log_to_query == ISAPI_UNDEF)
+ dir->log_to_query = (add->log_to_query == ISAPI_UNDEF)
? base->log_to_query
: add->log_to_query;
+ dir->fake_async = (add->fake_async == ISAPI_UNDEF)
+ ? base->fake_async
+ : add->fake_async;
return dir;
}
static const command_rec isapi_cmds[] = {
AP_INIT_TAKE1("ISAPIReadAheadBuffer", ap_set_int_slot,
(void *) APR_XtOffsetOf(isapi_dir_conf, read_ahead_buflen),
- OR_FILEINFO, "Maximum bytes to initially pass to the ISAPI handler"),
+ OR_FILEINFO, "Maximum client request body to initially pass to the"
+ " ISAPI handler (default: 48192)"),
AP_INIT_FLAG("ISAPILogNotSupported", ap_set_int_slot,
(void *) APR_XtOffsetOf(isapi_dir_conf, log_unsupported),
- OR_FILEINFO, "Log requests not supported by the ISAPI server"),
+ OR_FILEINFO, "Log requests not supported by the ISAPI server"
+ " on or off (default: off)"),
AP_INIT_FLAG("ISAPIAppendLogToErrors", ap_set_flag_slot,
(void *) APR_XtOffsetOf(isapi_dir_conf, log_to_errlog),
- OR_FILEINFO, "Send all Append Log requests to the error log"),
+ OR_FILEINFO, "Send all Append Log requests to the error log"
+ " on or off (default: off)"),
AP_INIT_FLAG("ISAPIAppendLogToQuery", ap_set_flag_slot,
(void *) APR_XtOffsetOf(isapi_dir_conf, log_to_query),
- OR_FILEINFO, "Append Log requests are concatinated to the query args"),
+ OR_FILEINFO, "Append Log requests are concatinated to the query args"
+ " on or off (default: on)"),
+ AP_INIT_FLAG("ISAPIFakeAsync", ap_set_flag_slot,
+ (void *) APR_XtOffsetOf(isapi_dir_conf, fake_async),
+ OR_FILEINFO, "Fake Asynchronous support for isapi callbacks"
+ " on or off [Experimental] (default: off)"),
AP_INIT_ITERATE("ISAPICacheFile", isapi_cmd_cachefile, NULL,
RSRC_CONF, "Cache the specified ISAPI extension in-process"),
{NULL}
apr_dso_handle_t *handle;
HSE_VERSION_INFO *isapi_version;
apr_uint32_t report_version;
+ apr_uint32_t timeout;
PFN_GETEXTENSIONVERSION GetExtensionVersion;
PFN_HTTPEXTENSIONPROC HttpExtensionProc;
PFN_TERMINATEEXTENSION TerminateExtension;
-#ifdef FAKE_ASYNC
- int fakeasync;
- apr_uint32_t timeout;
-#endif
};
static apr_status_t isapi_unload(isapi_loaded *isa, int force)
* location, etc) they apply to.
*/
isa->report_version = MAKELONG(0, 5); /* Revision 5.0 */
-#ifdef FAKE_ASYNC
isa->timeout = INFINITE; /* microsecs */
- isa->fakeasync = 1;
-#endif
rv = apr_dso_load(&isa->handle, isa->filename, p);
if (rv)
isapi_loaded *isa;
request_rec *r;
int headers_sent;
-#ifdef FAKE_ASYNC
PFN_HSE_IO_COMPLETION completion;
void *completion_arg;
apr_thread_mutex_t *completed;
-#endif
} isapi_cid;
int APR_THREAD_FUNC GetServerVariable (isapi_cid *cid,
APR_BRIGADE_INSERT_TAIL(bb, b);
rv = ap_pass_brigade(r->output_filters, bb);
-#ifdef FAKE_ASYNC
if ((flags & HSE_IO_ASYNC) && cid->completion) {
if (rv == OK) {
cid->completion(cid->ecb, cid->completion_arg,
*buf_size, ERROR_WRITE_FAULT);
}
}
-#endif
return (rv == OK);
}
statlen = strlen(stat);
}
else {
- char *flip = head;
+ const char *flip = head;
head = stat;
stat = flip;
headlen -= statlen;
/* Signal to resume the thread completing this request,
* leave it to the pool cleanup to dispose of our mutex.
*/
-#ifdef FAKE_ASYNC
if (cid->completed) {
apr_thread_mutex_unlock(cid->completed);
}
-#endif
return 1;
case HSE_REQ_MAP_URL_TO_PATH:
* Per MS docs... HSE_REQ_IO_COMPLETION replaces any prior call
* to HSE_REQ_IO_COMPLETION, and buf_data may be set to NULL.
*/
-#ifdef FAKE_ASYNC
- if (cid->isa->fakeasync) {
+ if (cid->dconf.fake_async) {
cid->completion = (PFN_HSE_IO_COMPLETION) buf_data;
cid->completion_arg = (void *) data_type;
return 1;
}
-#endif
if (cid->dconf.log_unsupported)
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r,
"ISAPI: ServerSupportFunction HSE_REQ_IO_COMPLETION "
case HSE_REQ_TRANSMIT_FILE:
{
+ /* we do nothing with (tf->dwFlags & HSE_DISCONNECT_AFTER_SEND)
+ */
HSE_TF_INFO *tf = (HSE_TF_INFO*)buf_data;
apr_uint32_t sent = 0;
apr_ssize_t ate = 0;
apr_file_t *fd;
apr_off_t fsize;
-#ifdef FAKE_ASYNC
- if (!cid->isa->fakeasync)
-#endif
- if (tf->dwFlags & HSE_IO_ASYNC)
- {
+ if (!cid->dconf.fake_async && (tf->dwFlags & HSE_IO_ASYNC)) {
if (cid->dconf.log_unsupported)
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r,
"ISAPI: ServerSupportFunction HSE_REQ_TRANSMIT_FILE "
APR_BRIGADE_INSERT_TAIL(bb, b);
ap_pass_brigade(r->output_filters, bb);
- /* we do nothing with (tf->dwFlags & HSE_DISCONNECT_AFTER_SEND)
+ /* Use tf->pfnHseIO + tf->pContext, or if NULL, then use cid->fnIOComplete
+ * pass pContect to the HseIO callback.
*/
-
-#ifdef FAKE_ASYNC
- /* Use tf->pfnHseIO + tf->pContext, or if NULL, then use cid->fnIOComplete
- * pass pContect to the HseIO callback.
- */
if (tf->dwFlags & HSE_IO_ASYNC) {
if (tf->pfnHseIO) {
if (rv == OK) {
}
}
}
-#endif
return (rv == OK);
}
case HSE_REQ_ASYNC_READ_CLIENT:
{
apr_uint32_t read = 0;
-#ifdef FAKE_ASYNC
int res;
- if (!cid->isa->fakeasync)
-#endif
- {
+ if (!cid->dconf.fake_async) {
if (cid->dconf.log_unsupported)
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r,
"ISAPI: asynchronous I/O not supported: %s",
return 0;
}
-#ifdef FAKE_ASYNC
if (r->remaining < *buf_size) {
*buf_size = (apr_size_t)r->remaining;
}
}
}
return (res >= 0);
-#endif
}
case HSE_REQ_GET_IMPERSONATION_TOKEN: /* Added in ISAPI 4.0 */
cid->dconf.log_unsupported = (dconf->log_unsupported == ISAPI_UNDEF)
? 0 : dconf->log_unsupported;
cid->dconf.log_to_errlog = (dconf->log_to_errlog == ISAPI_UNDEF)
- ? 1 : dconf->log_to_errlog;
+ ? 0 : dconf->log_to_errlog;
cid->dconf.log_to_query = (dconf->log_to_query == ISAPI_UNDEF)
? 1 : dconf->log_to_query;
+ cid->dconf.fake_async = (dconf->fake_async == ISAPI_UNDEF)
+ ? 0 : dconf->fake_async;
cid->ecb = apr_pcalloc(r->pool, sizeof(EXTENSION_CONTROL_BLOCK));
cid->ecb->ConnID = cid;
break;
case HSE_STATUS_PENDING:
-#ifdef FAKE_ASYNC
/* emulating async behavior...
*
* Create a cid->completed mutex and wait on it for some timeout
* This request completes upon a notification through
* ServerSupportFunction(HSE_REQ_DONE_WITH_SESSION)
*/
- if (isa->fakeasync)
- {
+ if (cid->dconf.fake_async) {
apr_thread_mutex_t *comp;
rv = apr_thread_mutex_create(&cid->completed,
}
break;
}
- else
-#endif
- if (cid->dconf.log_unsupported)
- {
+ else if (cid->dconf.log_unsupported) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, r,
"ISAPI: asynch I/O result HSE_STATUS_PENDING "
"from HttpExtensionProc() is not supported: %s",