From d9671919ed9d0cbdc71f4e83d4cc11d200482226 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Wed, 27 May 2015 09:01:07 +0200 Subject: 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. --- lib/inets/doc/src/Makefile | 3 +- lib/inets/doc/src/httpd.xml | 10 +++++- lib/inets/doc/src/httpd_custom_api.xml | 63 ++++++++++++++++++++++++++++++++++ lib/inets/doc/src/ref_man.xml | 3 +- 4 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 lib/inets/doc/src/httpd_custom_api.xml (limited to 'lib/inets/doc/src') diff --git a/lib/inets/doc/src/Makefile b/lib/inets/doc/src/Makefile index 1a8e1c7ca8..961bfa838d 100644 --- a/lib/inets/doc/src/Makefile +++ b/lib/inets/doc/src/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 1997-2012. All Rights Reserved. +# Copyright Ericsson AB 1997-2015. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -52,6 +52,7 @@ XML_REF3_FILES = \ httpc.xml\ httpd.xml \ httpd_conf.xml \ + httpd_custom_api.xml \ httpd_socket.xml \ httpd_util.xml \ mod_alias.xml \ diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml index e40660ab39..435f99ee23 100644 --- a/lib/inets/doc/src/httpd.xml +++ b/lib/inets/doc/src/httpd.xml @@ -204,7 +204,15 @@

Limit properties

- + + + + {customize, atom()} + +

A callback module to customize the inets HTTP servers behaviour + see httpd_custom_api

+
+ {disable_chunked_transfer_encoding_send, boolean()} diff --git a/lib/inets/doc/src/httpd_custom_api.xml b/lib/inets/doc/src/httpd_custom_api.xml new file mode 100644 index 0000000000..faf1d277df --- /dev/null +++ b/lib/inets/doc/src/httpd_custom_api.xml @@ -0,0 +1,63 @@ + + + + +
+ + 20152015 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + httpd_custom_api + httpd_custom_api.xml +
+ httpd_custom_api + Behaviour with optional callbacks to customize the inets HTTP server. + +

The module implementing this behaviour shall be supplied to to the servers + configuration with the option customize

+ +
+ + + response_header({HeaderName, HeaderValue}) -> {true, Header} | false + Filter and possible alter HTTP response headers. + + Header = {HeaderName :: string(), HeaderValue::string()} + The header name will be in lower case and should not be altered. + + +

Filter and possible alter HTTP response headers before they are sent to the client. +

+
+
+ + + request_header({HeaderName, HeaderValue}) -> {true, Header} | false + Filter and possible alter HTTP request headers. + + Header = {HeaderName :: string(), HeaderValue::string()} + The header name will be in lower case and should not be altered. + + +

Filter and possible alter HTTP request headers before they are processed by the server. +

+
+
+
+
+ + diff --git a/lib/inets/doc/src/ref_man.xml b/lib/inets/doc/src/ref_man.xml index aaedf330b4..3afb020431 100644 --- a/lib/inets/doc/src/ref_man.xml +++ b/lib/inets/doc/src/ref_man.xml @@ -4,7 +4,7 @@
- 19972013 + 19972015 Ericsson AB. All Rights Reserved. @@ -39,6 +39,7 @@ + -- cgit v1.2.3