summaryrefslogtreecommitdiff
path: root/src/mod_staticfile.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-07-06 22:58:13 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-09-04 08:08:26 -0400
commit91472ab7681b26f36b813f3b245c0e98f91b4c3f (patch)
treec0a71cb0f9d52747ec4c0409f8863b9f64233e83 /src/mod_staticfile.c
parenta0a8cf821d2292e6662119e158e73c175452f1c3 (diff)
downloadlighttpd-git-91472ab7681b26f36b813f3b245c0e98f91b4c3f.tar.gz
[tests] t/test_mod_staticfile
move some tests from tests/request.t to src/t/test_mod_staticfile.c
Diffstat (limited to 'src/mod_staticfile.c')
-rw-r--r--src/mod_staticfile.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c
index 763cc521..d39abe29 100644
--- a/src/mod_staticfile.c
+++ b/src/mod_staticfile.c
@@ -107,25 +107,19 @@ mod_staticfile_not_handled(request_st * const r, const char * const msg)
return HANDLER_GO_ON;
}
-URIHANDLER_FUNC(mod_staticfile_subrequest) {
- if (NULL != r->handler_module) return HANDLER_GO_ON;
- if (!http_method_get_head_post(r->http_method)) return HANDLER_GO_ON;
- /* r->physical.path is non-empty for handle_subrequest_start */
- /*if (buffer_is_blank(&r->physical.path)) return HANDLER_GO_ON;*/
-
- plugin_data * const p = p_d;
- mod_staticfile_patch_config(r, p);
-
- if (p->conf.disable_pathinfo && !buffer_is_blank(&r->pathinfo)) {
+static handler_t
+mod_staticfile_process (request_st * const r, plugin_config * const pconf)
+{
+ if (pconf->disable_pathinfo && !buffer_is_blank(&r->pathinfo)) {
return mod_staticfile_not_handled(r, "pathinfo");
}
- if (p->conf.exclude_ext
- && array_match_value_suffix(p->conf.exclude_ext, &r->physical.path)) {
+ if (pconf->exclude_ext
+ && array_match_value_suffix(pconf->exclude_ext, &r->physical.path)) {
return mod_staticfile_not_handled(r, "extension");
}
- if (!p->conf.etags_used) r->conf.etag_flags = 0;
+ if (!pconf->etags_used) r->conf.etag_flags = 0;
/* r->tmp_sce is set in http_response_physical_path_check() and is valid
* in handle_subrequest_start callback -- handle_subrequest_start callbacks
@@ -138,6 +132,18 @@ URIHANDLER_FUNC(mod_staticfile_subrequest) {
return HANDLER_FINISHED;
}
+URIHANDLER_FUNC(mod_staticfile_subrequest) {
+ if (NULL != r->handler_module) return HANDLER_GO_ON;
+ if (!http_method_get_head_post(r->http_method)) return HANDLER_GO_ON;
+ /* r->physical.path is non-empty for handle_subrequest_start */
+ /*if (buffer_is_blank(&r->physical.path)) return HANDLER_GO_ON;*/
+
+ plugin_data * const p = p_d;
+ mod_staticfile_patch_config(r, p);
+
+ return mod_staticfile_process(r, &p->conf);
+}
+
int mod_staticfile_plugin_init(plugin *p);
int mod_staticfile_plugin_init(plugin *p) {