aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_server/httpd_request_handler.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2015-05-27 09:01:07 +0200
committerIngela Anderton Andin <[email protected]>2015-05-29 14:58:22 +0200
commitd9671919ed9d0cbdc71f4e83d4cc11d200482226 (patch)
treec7225d83b4eb9ac449762fe19ae092eee40f904f /lib/inets/src/http_server/httpd_request_handler.erl
parentf3fefbae24a2569a13b538d80d0e99129963ebef (diff)
downloadotp-d9671919ed9d0cbdc71f4e83d4cc11d200482226.tar.gz
otp-d9671919ed9d0cbdc71f4e83d4cc11d200482226.tar.bz2
otp-d9671919ed9d0cbdc71f4e83d4cc11d200482226.zip
inets: Add customize option
Many HTTP headers are optional, and it could be desirable for the server to filter and maybe even alter them without replacing the mod_* modules that generate/process them. Add new behaviour httpd_custom_api with default implementation in httpd_custom.erl. Add behaviour module in 18 as then we can specify optional callbacks.
Diffstat (limited to 'lib/inets/src/http_server/httpd_request_handler.erl')
-rw-r--r--lib/inets/src/http_server/httpd_request_handler.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl
index f7a9fe5d49..9947e17b47 100644
--- a/lib/inets/src/http_server/httpd_request_handler.erl
+++ b/lib/inets/src/http_server/httpd_request_handler.erl
@@ -121,13 +121,15 @@ continue_init(Manager, ConfigDB, SocketType, Socket, TimeOut) ->
MaxURISize = max_uri_size(ConfigDB),
NrOfRequest = max_keep_alive_request(ConfigDB),
MaxContentLen = max_content_length(ConfigDB),
+ Customize = customize(ConfigDB),
{_, Status} = httpd_manager:new_connection(Manager),
MFA = {httpd_request, parse, [[{max_uri, MaxURISize}, {max_header, MaxHeaderSize},
{max_version, ?HTTP_MAX_VERSION_STRING},
{max_method, ?HTTP_MAX_METHOD_STRING},
- {max_content_length, MaxContentLen}
+ {max_content_length, MaxContentLen},
+ {customize, Customize}
]]},
State = #state{mod = Mod,
@@ -550,11 +552,13 @@ handle_next_request(#state{mod = #mod{connection = true} = ModData,
MaxHeaderSize = max_header_size(ModData#mod.config_db),
MaxURISize = max_uri_size(ModData#mod.config_db),
MaxContentLen = max_content_length(ModData#mod.config_db),
+ Customize = customize(ModData#mod.config_db),
MFA = {httpd_request, parse, [[{max_uri, MaxURISize}, {max_header, MaxHeaderSize},
{max_version, ?HTTP_MAX_VERSION_STRING},
{max_method, ?HTTP_MAX_METHOD_STRING},
- {max_content_length, MaxContentLen}
+ {max_content_length, MaxContentLen},
+ {customize, Customize}
]]},
TmpState = State#state{mod = NewModData,
mfa = MFA,
@@ -640,3 +644,6 @@ max_keep_alive_request(ConfigDB) ->
max_content_length(ConfigDB) ->
httpd_util:lookup(ConfigDB, max_content_length, ?HTTP_MAX_CONTENT_LENGTH).
+
+customize(ConfigDB) ->
+ httpd_util:lookup(ConfigDB, customize, httpd_custom).