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

📄 mod_gsoap.c

📁 apache模组的源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
     * case.     *     * We also need to start a timer so the server can know if the connection     * is broken.     */    ap_soft_timeout("gsoap xml response", r);    /*     * If we're only supposed to send header information (HEAD request), we're     * already there.     */    if (r->header_only) {    	ap_send_http_header(r);		ap_kill_timeout(r);        return OK;    }    if (NULL != pszError) {    	SendErrorMessage(r, pszError);		ap_kill_timeout(r);    	return OK;    }    nRet = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);    if (OK != nRet) {		SendErrorMessage(r, "Failed to start receiving POST buffer");		ap_kill_timeout(r);        return OK;    }    nRet = ap_should_client_block(r);    if (0 == nRet) {		SendErrorMessage(r, "No body received");		ap_kill_timeout(r);		return OK;    }    if (NULL != pszError) {		ap_log_error(APLOG_MARK, APLOG_ERR, r->server, pszError);		SendErrorMessage(r, pszError);		ap_kill_timeout(r);		return OK;    }    if (NULL != pIntf->fsoap_init) {		(*pIntf->fsoap_init)(psoap);		set_callbacks(r, pRqConf, psoap);		if (NULL != pIntf->fsoap_serve) {			int nRet = (*pIntf->fsoap_serve)(psoap);		} else {			SendErrorMessage(r, "no soap_serve entry point");			ap_kill_timeout(r);			return OK;		}		if (NULL != pIntf->fsoap_destroy) {			pIntf->fsoap_destroy; // not an error in 2.1.10 any more.		}		if (NULL != pIntf->fsoap_end) {			pIntf->fsoap_end(psoap);		} else {			SendErrorMessage(r, "no soap_end entry point");			ap_kill_timeout(r);		}		if (NULL != pIntf->fsoap_done) {			pIntf->fsoap_done(psoap);		} else {			SendErrorMessage(r, "no soap_done entry point");			ap_kill_timeout(r);		}    } else {		SendErrorMessage(r, "no soap_init entry point");		ap_kill_timeout(r);		return OK;    }    /*     * We did what we wanted to do, so tell the rest of the server we     * succeeded. We need not delete pszResponse, because it was allocated from the request pool.     */    ap_kill_timeout(r);    return OK;}/*--------------------------------------------------------------------------*//*                                                                          *//* Now let's declare routines for each of the callback phase in order.      *//* (That's the order in which they're listed in the callback list, *not     *//* the order in which the server calls them!  See the command_rec           *//* declaration).  Note that these may be                                    *//* called for situations that don't relate primarily to our function - in   *//* other words, the fixup handler shouldn't assume that the request has     *//* to do with "gsoap" stuff.                                                *//*                                                                          *//* With the exception of the content handler, all of our routines will be   *//* called for each request, unless an earlier handler from another module   *//* aborted the sequence.                                                    *//*                                                                          *//* Handlers that are declared as "int" can return the following:            *//*                                                                          *//*  OK          Handler accepted the request and did its thing with it.     *//*  DECLINED    Handler took no action.                                     *//*  HTTP_mumble Handler looked at request and found it wanting.             *//*                                                                          *//* What the server does after calling a module handler depends upon the     *//* handler's return value.  In all cases, if the handler returns            *//* DECLINED, the server will continue to the next module with an handler    *//* for the current phase.  However, if the handler return a non-OK,         *//* non-DECLINED status, the server aborts the request right there.  If      *//* the handler returns OK, the server's next action is phase-specific;      *//* see the individual handler comments below for details.                   *//*                                                                          *//*--------------------------------------------------------------------------*//*  * This function is called during server initialisation.  Any information * that needs to be recorded must be in static cells, since there's no * configuration record. * * There is no return value. */static void gsoap_init(server_rec *s, pool *p){//    ap_log_error(APLOG_MARK, APLOG_ERR, s, "mod_gsoap initialized", NULL);}/*  * This function is called during server initialisation when an heavy-weight * process (such as a child) is being initialised.  As with the * module-initialisation function, any information that needs to be recorded * must be in static cells, since there's no configuration record. * * There is no return value. */static void gsoap_child_init(server_rec *s, pool *p) {}/*  * This function is called when an heavy-weight process (such as a child) is * being run down or destroyed.  As with the child-initialisation function, * any information that needs to be recorded must be in static cells, since * there's no configuration record. * * There is no return value. */static void gsoap_child_exit(server_rec *s, pool *p) {    //gsoapConfiguration::getLibraries()->clear();}/* * This function gets called to create a per-directory configuration * record.  This will be called for the "default" server environment, and for * each directory for which the parser finds any of our directives applicable. * If a directory doesn't have any of our directives involved (i.e., they * aren't in the .htaccess file, or a <Location>, <Directory>, or related * block), this routine will *not* be called - the configuration for the * closest ancestor is used. * * The return value is a pointer to the created module-specific * structure. */static void *gsoap_create_dir_config(pool *p, char *dirspec) {    gsoapConfiguration *pConfig = gsoapConfiguration_create(p);    pConfig->m_Type = ct_directory;    return pConfig;}/* * This function gets called to merge two per-directory configuration * records.  This is typically done to cope with things like .htaccess files * or <Location> directives for directories that are beneath one for which a * configuration record was already created.  The routine has the * responsibility of creating a new record and merging the contents of the * other two into it appropriately.  If the module doesn't declare a merge * routine, the record for the closest ancestor location (that has one) is * used exclusively. * * The routine MUST NOT modify any of its arguments! * * The return value is a pointer to the created module-specific structure * containing the merged values. */static void *gsoap_merge_dir_config(pool *p, void *parent_conf,void *newloc_conf) {    gsoapConfiguration *pMergedConfig = gsoapConfiguration_create(p);    gsoapConfiguration *pParentConfig = (gsoapConfiguration *)parent_conf;    gsoapConfiguration *pNewConfig = (gsoapConfiguration *)newloc_conf;    gsoapConfiguration_merge(pMergedConfig, pParentConfig, pNewConfig);    return pMergedConfig;}/* * This function gets called to create a per-server configuration * record.  It will always be called for the "default" server. * * The return value is a pointer to the created module-specific * structure. */static void *gsoap_create_server_config(pool *p, server_rec *s) {    gsoapConfiguration *pConfig = gsoapConfiguration_create(p);    pConfig->m_Type = ct_server;    return pConfig;}/* * This function gets called to merge two per-server configuration * records.  This is typically done to cope with things like virtual hosts and * the default server configuration. The routine has the responsibility of * creating a new record and merging the contents of the other two into it * appropriately. If the module doesn't declare a merge routine, the more * specific existing record is used exclusively. * * The routine MUST NOT modify any of its arguments! * * The return value is a pointer to the created module-specific structure * containing the merged values. */static void *gsoap_merge_server_config(pool *p, void *server1_conf,									   void *server2_conf){    gsoapConfiguration *pMergedConfig = gsoapConfiguration_create(p);    gsoapConfiguration *pServer1Config = (gsoapConfiguration *)server1_conf;    gsoapConfiguration *pServer2Config = (gsoapConfiguration *)server2_conf;    gsoapConfiguration_merge(pMergedConfig, pServer1Config, pServer2Config);    pMergedConfig->m_Type = ct_server;    return (void *)pMergedConfig;}/* * This routine is called after the request has been read but before any other * phases have been processed.  This allows us to make decisions based upon * the input header fields. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * further modules are called for this phase. */static int gsoap_post_read_request(request_rec *r) {    return DECLINED;}/* * This routine gives our module an opportunity to translate the URI into an * actual filename.  If we don't do anything special, the server's default * rules (Alias directives and the like) will continue to be followed. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * further modules are called for this phase. */static int gsoap_translate_handler(request_rec *r) {    return DECLINED;}/* * This routine is called to check the authentication information sent with * the request (such as looking up the user in a database and verifying that * the [encrypted] password sent matches the one in the database). * * The return value is OK, DECLINED, or some HTTP_mumble error (typically * HTTP_UNAUTHORIZED).  If we return OK, no other modules are given a chance * at the request during this phase. */static int gsoap_check_user_id(request_rec *r) {    return DECLINED;}/* * This routine is called to check to see if the resource being requested * requires authorisation. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * other modules are called during this phase. * * If *all* modules return DECLINED, the request is aborted with a server * error. */static int gsoap_auth_checker(request_rec *r) {    return DECLINED;}/* * This routine is called to check for any module-specific restrictions placed * upon the requested resource.  (See the mod_access module for an example.) * * The return value is OK, DECLINED, or HTTP_mumble.  All modules with an * handler for this phase are called regardless of whether their predecessors * return OK or DECLINED.  The first one to return any other status, however, * will abort the sequence (and the request) as usual. */static int gsoap_access_checker(request_rec *r) {    return DECLINED;}/* * This routine is called to determine and/or set the various document type * information bits, like Content-type (via r->content_type), language, et * cetera. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no * further modules are given a chance at the request for this phase. */static int gsoap_type_checker(request_rec *r) {    return DECLINED;}/* * This routine is called to perform any module-specific fixing of header * fields, et cetera.  It is invoked just before any content-handler. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, the * server will still call any remaining modules with an handler for this * phase. */static int gsoap_fixer_upper(request_rec *r) {    return OK;}/* * This routine is called to perform any module-specific logging activities * over and above the normal server things. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, any * remaining modules with an handler for this phase will still be called. */static int gsoap_logger(request_rec *r) {    return DECLINED;}/* * This routine is called to give the module a chance to look at the request * headers and take any appropriate specific actions early in the processing * sequence. * * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, any * remaining modules with handlers for this phase will still be called. */static int gsoap_header_parser(request_rec *r) {    return DECLINED;}/** helper funciton for library command handler. * @param pszPath the path of the library. * @param bIsSOAPLibrary true if it is a shared library containing a SOAP server. * @return true if the library was added, false if it was aleady in the collection. */static bool AddSharedLibrary(gsoapConfiguration *pConfig, const char *pszPath, const bool bIsSOAPLibrary) {    bool bAdded = false;    pool *pPool = gsoapConfiguration_getModulePool();    if (!SoapSharedLibraries_contains(pConfig->m_pLibraries, pszPath)) {		SoapSharedLibrary *pLibrary = SoapSharedLibrary_create(pPool);		SoapSharedLibrary_init2(pLibrary, pPool, ap_pstrdup(pPool, pszPath));		pLibrary->m_bIsSOAPLibrary = bIsSOAPLibrary;		SoapSharedLibraries_addLibrary(pConfig->m_pLibraries, pLibrary);		bAdded = true;    }    return bAdded;}static gsoapConfiguration *getConfiguration(request_rec *r) {    return (gsoapConfiguration *)ap_get_module_config(r->per_dir_config, &gsoap_module);}static gsoapRequestConfiguration *getRequestConfiguration(struct soap *soap) {	gsoapRequestConfiguration *pRqConf = (gsoapRequestConfiguration *)soap->fplugin(soap, GSOAP_ID);	return pRqConf;}

⌨️ 快捷键说明

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