Found the problem that made the module fail. The module definition needed to have the same struct name as the module.

This commit is contained in:
2024-04-12 00:08:25 +03:00
parent d4f0165726
commit f40e4a32d0

View File

@@ -162,7 +162,7 @@ static ngx_command_t ngx_http_dav_ext_commands[] = {
ngx_null_command};
// Function references for nginx to create the configurations with
static ngx_http_module_t ngx_http_dav_ext_module_ctx = {
static ngx_http_module_t ngx_http_webdav_module_ctx = {
NULL, /* preconfiguration */
ngx_http_dav_ext_init, /* postconfiguration */
@@ -177,9 +177,9 @@ static ngx_http_module_t ngx_http_dav_ext_module_ctx = {
};
// The module definition
ngx_module_t ngx_http_dav_ext_module = {
ngx_module_t ngx_http_webdav_module = {
NGX_MODULE_V1,
&ngx_http_dav_ext_module_ctx, /* module context */
&ngx_http_webdav_module_ctx, /* module context */
ngx_http_dav_ext_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
@@ -200,7 +200,7 @@ static ngx_int_t ngx_http_dav_ext_precontent_handler(ngx_http_request_t *r) {
ngx_table_elt_t *dest;
ngx_http_dav_ext_loc_conf_t *dlcf;
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
if (dlcf->shm_zone == NULL) {
return NGX_DECLINED;
@@ -253,7 +253,7 @@ static ngx_int_t ngx_http_dav_ext_verify_lock(ngx_http_request_t *r,
token = ngx_http_dav_ext_if(r, uri);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
lock = dlcf->shm_zone->data;
ngx_shmtx_lock(&lock->shpool->mutex);
@@ -297,7 +297,7 @@ static ngx_int_t ngx_http_dav_ext_content_handler(ngx_http_request_t *r) {
ngx_table_elt_t *h;
ngx_http_dav_ext_loc_conf_t *dlcf;
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
if (!(r->method & dlcf->methods)) {
return NGX_DECLINED;
@@ -934,7 +934,7 @@ static ngx_int_t ngx_http_dav_ext_lock_handler(ngx_http_request_t *r) {
return NGX_HTTP_BAD_REQUEST;
}
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
lock = dlcf->shm_zone->data;
/*
@@ -1156,7 +1156,7 @@ static ngx_int_t ngx_http_dav_ext_unlock_handler(ngx_http_request_t *r) {
token = ngx_http_dav_ext_lock_token(r);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
lock = dlcf->shm_zone->data;
ngx_shmtx_lock(&lock->shpool->mutex);
@@ -1591,7 +1591,7 @@ static char *ngx_http_dav_ext_lock_zone(ngx_conf_t *cf, ngx_command_t *cmd,
lock->timeout = timeout;
shm_zone = ngx_shared_memory_add(cf, &name, size, &ngx_http_dav_ext_module);
shm_zone = ngx_shared_memory_add(cf, &name, size, &ngx_http_webdav_module);
if (shm_zone == NULL) {
return NGX_CONF_ERROR;
}
@@ -1631,7 +1631,7 @@ static char *ngx_http_dav_ext_lock(ngx_conf_t *cf, ngx_command_t *cmd,
s.len = value[i].len - 5;
s.data = value[i].data + 5;
shm_zone = ngx_shared_memory_add(cf, &s, 0, &ngx_http_dav_ext_module);
shm_zone = ngx_shared_memory_add(cf, &s, 0, &ngx_http_webdav_module);
if (shm_zone == NULL) {
return NGX_CONF_ERROR;
}
@@ -1740,7 +1740,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
}
}
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
ext.access = dlcf->access;
ext.path_access = dlcf->access;
@@ -1798,7 +1798,7 @@ ngx_http_dav_delete_handler(ngx_http_request_t *r)
return NGX_HTTP_UNSUPPORTED_MEDIA_TYPE;
}
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
if (dlcf->min_delete_depth) {
d = 0;
@@ -2197,7 +2197,7 @@ overwrite_done:
if (r->method == NGX_HTTP_MOVE) {
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
ext.access = 0;
ext.path_access = dlcf->access;
@@ -2374,7 +2374,7 @@ ngx_int_t ngx_http_dav_ext_set_locks(ngx_http_request_t *r,
ngx_http_dav_ext_lock_t *lock;
ngx_http_dav_ext_loc_conf_t *dlcf;
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_ext_module);
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_webdav_module);
if (dlcf->shm_zone == NULL) {
entry->lock_supported = 0;