⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_isapi.c

📁 apache 安装教程 apache 安装教程
💻 C
📖 第 1 页 / 共 3 页
字号:
            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI asynchronous I/O not supported: %s",                           r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    case 1007: /* HSE_REQ_REFRESH_ISAPI_ACL */        /* Since we don't override the user ID and access, we can't reset.         */        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI ServerSupportFunction "                          "HSE_REQ_REFRESH_ISAPI_ACL "                          "is not supported: %s", r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    case 1008: /* HSE_REQ_IS_KEEP_CONN */        *((LPBOOL) lpvBuffer) = (r->connection->keepalive == 1);        return TRUE;    case 1010: /* HSE_REQ_ASYNC_READ_CLIENT */        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI asynchronous I/O not supported: %s",                           r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    case 1011: /* HSE_REQ_GET_IMPERSONATION_TOKEN  Added in ISAPI 4.0 */        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI ServerSupportFunction "                          "HSE_REQ_GET_IMPERSONATION_TOKEN "                          "is not supported: %s", r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;#ifdef HSE_REQ_MAP_URL_TO_PATH_EX    case 1012: /* HSE_REQ_MAP_URL_TO_PATH_EX */    {        /* Map a URL to a filename */        LPHSE_URL_MAPEX_INFO info = (LPHSE_URL_MAPEX_INFO) lpdwDataType;        char* test_uri = ap_pstrndup(r->pool, (char *)lpvBuffer, *lpdwSize);        subreq = ap_sub_req_lookup_uri(test_uri, r);        info->cchMatchingURL = strlen(test_uri);                info->cchMatchingPath = ap_cpystrn(info->lpszPath, subreq->filename,                                            MAX_PATH) - info->lpszPath;                /* Mapping started with assuming both strings matched.         * Now roll on the path_info as a mismatch and handle         * terminating slashes for directory matches.         */        if (subreq->path_info && *subreq->path_info) {            ap_cpystrn(info->lpszPath + info->cchMatchingPath,                        subreq->path_info, MAX_PATH - info->cchMatchingPath);            info->cchMatchingURL -= strlen(subreq->path_info);            if (S_ISDIR(subreq->finfo.st_mode)                 && info->cchMatchingPath < MAX_PATH - 1) {                /* roll forward over path_info's first slash */                ++info->cchMatchingPath;                ++info->cchMatchingURL;            }        }        else if (S_ISDIR(subreq->finfo.st_mode)                 && info->cchMatchingPath < MAX_PATH - 1) {            /* Add a trailing slash for directory */            info->lpszPath[info->cchMatchingPath++] = '/';            info->lpszPath[info->cchMatchingPath] = '\0';        }        /* If the matched isn't a file, roll match back to the prior slash */        if (!subreq->finfo.st_mode) {            while (info->cchMatchingPath && info->cchMatchingURL) {                if (info->lpszPath[info->cchMatchingPath - 1] == '/')                     break;                --info->cchMatchingPath;                --info->cchMatchingURL;            }        }                /* Paths returned with back slashes */        for (test_uri = info->lpszPath; *test_uri; ++test_uri)            if (*test_uri == '/')                *test_uri = '\\';                /* is a combination of:         * HSE_URL_FLAGS_READ         0x001 Allow read         * HSE_URL_FLAGS_WRITE        0x002 Allow write         * HSE_URL_FLAGS_EXECUTE      0x004 Allow execute         * HSE_URL_FLAGS_SSL          0x008 Require SSL         * HSE_URL_FLAGS_DONT_CACHE   0x010 Don't cache (VRoot only)         * HSE_URL_FLAGS_NEGO_CERT    0x020 Allow client SSL cert         * HSE_URL_FLAGS_REQUIRE_CERT 0x040 Require client SSL cert         * HSE_URL_FLAGS_MAP_CERT     0x080 Map client SSL cert to account         * HSE_URL_FLAGS_SSL128       0x100 Require 128-bit SSL cert         * HSE_URL_FLAGS_SCRIPT       0x200 Allow script execution         *         * XxX: As everywhere, EXEC flags could use some work...         *      and this could go further with more flags, as desired.         */         info->dwFlags = (subreq->finfo.st_mode & _S_IREAD  ? 0x001 : 0)                      | (subreq->finfo.st_mode & _S_IWRITE ? 0x002 : 0)                      | (subreq->finfo.st_mode & _S_IEXEC  ? 0x204 : 0);        return TRUE;    }#endif    case 1014: /* HSE_REQ_ABORTIVE_CLOSE */        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI ServerSupportFunction HSE_REQ_ABORTIVE_CLOSE"                          " is not supported: %s", r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    case 1015: /* HSE_REQ_GET_CERT_INFO_EX  Added in ISAPI 4.0 */        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI ServerSupportFunction "                          "HSE_REQ_GET_CERT_INFO_EX "                          "is not supported: %s", r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;#ifdef HSE_REQ_SEND_RESPONSE_HEADER_EX    case 1016: /* HSE_REQ_SEND_RESPONSE_HEADER_EX  Added in ISAPI 4.0 */    {        LPHSE_SEND_HEADER_EX_INFO shi                                  = (LPHSE_SEND_HEADER_EX_INFO) lpvBuffer;        /* XXX: ignore shi->fKeepConn?  We shouldn't need the advise */        /* r->connection->keepalive = shi->fKeepConn; */        return SendResponseHeaderEx(cid, shi->pszStatus, shi->pszHeader,                                         shi->cchStatus, shi->cchHeader);    }#endif    case 1017: /* HSE_REQ_CLOSE_CONNECTION  Added after ISAPI 4.0 */        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI ServerSupportFunction "                          "HSE_REQ_CLOSE_CONNECTION "                          "is not supported: %s", r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    case 1018: /* HSE_REQ_IS_CONNECTED  Added after ISAPI 4.0 */        /* Returns True if client is connected c.f. MSKB Q188346         * XXX: That statement is very ambigious... assuming the          * identical return mechanism as HSE_REQ_IS_KEEP_CONN.         */        *((LPBOOL) lpvBuffer) = (r->connection->aborted == 0);        return TRUE;    case 1020: /* HSE_REQ_EXTENSION_TRIGGER  Added after ISAPI 4.0 */        /*  Undocumented - defined by the Microsoft Jan '00 Platform SDK         */        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI ServerSupportFunction "                          "HSE_REQ_EXTENSION_TRIGGER "                          "is not supported: %s", r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    default:        if (LogNotSupported)            ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, r,                          "ISAPI ServerSupportFunction (%d) not supported: "                          "%s", dwHSERequest, r->filename);        SetLastError(ERROR_INVALID_PARAMETER);        return FALSE;    }}/* * Command handler for the ISAPIReadAheadBuffer directive, which is TAKE1 */static const char *isapi_cmd_readaheadbuffer(cmd_parms *cmd, void *config,                                              char *arg){    long val;    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);    if (err != NULL) {        return err;    }    if (((val = ap_strtol(arg, (char **) &err, 10)) <= 0) || *err)        return "ISAPIReadAheadBuffer must be a legitimate value.";        ReadAheadBuffer = val;    return NULL;}/* * Command handler for the ISAPIReadAheadBuffer directive, which is TAKE1 */static const char *isapi_cmd_lognotsupported(cmd_parms *cmd, void *config,                                              char *arg){    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);    if (err != NULL) {        return err;    }    if (strcasecmp(arg, "on") == 0) {        LogNotSupported = -1;    }    else if (strcasecmp(arg, "off") == 0) {        LogNotSupported = 0;    }    else {        return "ISAPILogNotSupported must be on or off";    }    return NULL;}static const char *isapi_cmd_appendlogtoerrors(cmd_parms *cmd, void *config,                                                char *arg){    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);    if (err != NULL) {        return err;    }    if (strcasecmp(arg, "on") == 0) {        AppendLogToErrors = -1;    }    else if (strcasecmp(arg, "off") == 0) {        AppendLogToErrors = 0;    }    else {        return "ISAPIAppendLogToErrors must be on or off";    }    return NULL;}static const char *isapi_cmd_appendlogtoquery(cmd_parms *cmd, void *config,                                                char *arg){    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);    if (err != NULL) {        return err;    }    if (strcasecmp(arg, "on") == 0) {        AppendLogToQuery = -1;    }    else if (strcasecmp(arg, "off") == 0) {        AppendLogToQuery = 0;    }    else {        return "ISAPIAppendLogToQuery must be on or off";    }    return NULL;}static const command_rec isapi_cmds[] = {{ "ISAPIReadAheadBuffer", isapi_cmd_readaheadbuffer, NULL, RSRC_CONF, TAKE1,   "Maximum bytes to initially pass to the ISAPI handler" },{ "ISAPILogNotSupported", isapi_cmd_lognotsupported, NULL, RSRC_CONF, TAKE1,   "Log requests not supported by the ISAPI server" },{ "ISAPIAppendLogToErrors", isapi_cmd_appendlogtoerrors, NULL, RSRC_CONF, TAKE1,   "Send all Append Log requests to the error log" },{ "ISAPIAppendLogToQuery", isapi_cmd_appendlogtoquery, NULL, RSRC_CONF, TAKE1,   "Append Log requests are concatinated to the query args" },{ NULL }};handler_rec isapi_handlers[] = {{ "isapi-isa", isapi_handler },{ NULL}};module isapi_module = {   STANDARD_MODULE_STUFF,   NULL,                        /* initializer */   NULL,                        /* create per-dir config */   NULL,                        /* merge per-dir config */   NULL,                        /* server config */   NULL,                        /* merge server config */   isapi_cmds,                  /* command table */   isapi_handlers,              /* handlers */   NULL,                        /* filename translation */   NULL,                        /* check_user_id */   NULL,                        /* check auth */   NULL,                        /* check access */   NULL,                        /* type_checker */   NULL,                        /* logger */   NULL                         /* header parser */};#endif /* WIN32 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -