Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
1416-inets-add-missing-mime_type-functionality-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1416-inets-add-missing-mime_type-functionality-to-httpd.patch of Package erlang
From a7212dc77512dd9146ebc89600a9f586f4faf8ff Mon Sep 17 00:00:00 2001 From: Erika Rowland <accounts@erikarowland.com> Date: Wed, 8 Nov 2023 21:25:54 +0000 Subject: [PATCH 1/2] inets: add missing mime_type functionality to httpd --- lib/inets/src/http_server/httpd_conf.erl | 5 +++++ lib/inets/src/http_server/httpd_util.erl | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/inets/src/http_server/httpd_conf.erl b/lib/inets/src/http_server/httpd_conf.erl index ffa9a23fec..c188e15651 100644 --- a/lib/inets/src/http_server/httpd_conf.erl +++ b/lib/inets/src/http_server/httpd_conf.erl @@ -286,6 +286,11 @@ validate_config_params([{default_type, Value} | Rest]) when is_list(Value) -> validate_config_params([{default_type, Value} | _]) -> throw({default_type, Value}); +validate_config_params([{mime_type, Value} | Rest]) when is_list(Value) -> + validate_config_params(Rest); +validate_config_params([{mime_type, Value} | _]) -> + throw({mime_type, Value}); + validate_config_params([{logger, Value} | Rest]) when is_list(Value) -> true = validate_logger(Value), validate_config_params(Rest); diff --git a/lib/inets/src/http_server/httpd_util.erl b/lib/inets/src/http_server/httpd_util.erl index ff75303722..d6c0626d62 100644 --- a/lib/inets/src/http_server/httpd_util.erl +++ b/lib/inets/src/http_server/httpd_util.erl @@ -121,11 +121,18 @@ lookup_mime_default(ConfigDB,Suffix,Undefined) -> [{mime_types,MimeTypesDB}|_]=ets:lookup(ConfigDB,mime_types), case ets:lookup(MimeTypesDB,Suffix) of [] -> - case ets:lookup(ConfigDB,default_type) of + case ets:lookup(ConfigDB,mime_type) of [] -> - Undefined; - [{default_type,DefaultType}|_] -> - DefaultType + %% `default_type` is a legacy undocumented property + %% it's left here as a fallback case for backwards compatibility + case ets:lookup(ConfigDB,default_type) of + [] -> + Undefined; + [{default_type,DefaultType}|_] -> + DefaultType + end; + [{mime_type,DefaultMimeType}|_] -> + DefaultMimeType end; [{Suffix,MimeType}|_] -> MimeType -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor