English 中文(简体)
为什么要求:在我的阿帕奇模块中要求使用“打字”——打字机——打字机”时,档案名称UNL?
原标题:Why is request_rec::filename NULL when the ap_hook_type_checker function is called in my Apache 2.2 module?

我有一个阿帕奇模块,在CentOS适当运作,但乌班图失败。 我已把问题跟踪到请求记录中载有在<代码>request_rec上存档名称的NUL价值。 用于检查所处理档案档案的档案类型,因此,Pharma正作为理由向我模块中界定的“一” h功能。

i.e.,

extern "C" module AP_MODULE_DECLARE_DATA  MyModule = {
STANDARD20_MODULE_STUFF,     // initializer
NULL,                        // create per-dir config
NULL,                        // merge per-dir config
NULL,                        // server config
NULL,                        // merge server config
MyCommandTable,              // command table
MyRegisterHooks              // register hooks
};

......

static void MyRegisterHooks(apr_pool_t *p)
{
ap_hook_child_init(MyPluginInit, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_type_checker(MyCheckAppFileType, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_handler(MyFileHandler,NULL,NULL,APR_HOOK_MIDDLE);
}

......,最后,罪犯职能:

static int MyCheckAppFileType(request_rec *ap_req)
{
if(ap_req == NULL)
{
    return DECLINED; // Not reached
}

if(ap_req->filename == NULL)
{
    return DECLINED; // HERE is the problem ... Why is ap_req->filename NULL?
                     // On CentOS it is not NULL, only on Ubuntu.
}

    // ...
}

我在乌班图和中西斯两地都使用帕帕帕奇2.2,我独立地从两个系统的头盔中修建了单元。

FURTHER INFO ~3 months later: I have discovered that building the module on CentOS, and then copying the binary over to Ubuntu, and it works. Taking the identical code and building it on Ubuntu causes the above failure at runtime. Therefore, the code does not necessarily seem to be the problem -- or at least there is something being handled by the compiler differently on the two systems that is causing success with the CentOS build but not the Ubuntu build.

问题回答

我现在谈了一个几乎相同的问题。 I m使用他人所写的模块。 在一个测试机器上,该模块正在正确进行 au和 au。 不同机器的<代码>r->filename为NUL within the authecker hook. 你在此提出的问题首先在我的洞.中提出。

在我的案件中,我把这一数据追踪到对<代码>ap_set_module_config的错误使用。 该法典认为:

ap_set_module_config(r, &auth_my_module, attrs);

<代码>ap_set_module_config的源代码 这就是说:

/**
 * Generic accessors for other modules to set at their own module-specific
 * data
 * @param conf_vector The vector in which the modules configuration is stored.
 *        usually r->per_dir_config or s->module_config
 * @param m The module to set the data for.
 * @param val The module-specific data to set
 */
AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
                                      void *val);

我将电话改为ap_set_module_config:

ap_set_module_config(r->per_dir_config, &auth_my_module, attrs);

仅像魔.,r->filename,在 au中已不再有NUL。 我说,我是新鲜的,想写一刀切的单元,因此,我需要确切地了解这意味着什么,但我很高兴看到问题在哪里。 你可以检查你的代码,看看你如何打电话ap_set_module_config

<><>Edit>: 我要补充的是,我通过添加一些精细的词句来跟踪这一节点,这些缩略语在<条码>栏目<>><条码>领域<条码>时就显示我。 结构改为NUL。 对于我来说,它从有效到NUL,在界定的背后一条中。

亲爱!





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签