diff options
author | Ingela Anderton Andin <[email protected]> | 2016-04-20 22:13:45 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2016-04-21 17:30:24 +0200 |
commit | e1e8233759f835025f15da302f2a37ff6845d600 (patch) | |
tree | cbf0a7de9400b15dc83daea8045751159f5555c2 /lib/inets/src/http_server/httpd_example.erl | |
parent | afe72bfc1448ff426c38eceb7412f69e973aef62 (diff) | |
download | otp-e1e8233759f835025f15da302f2a37ff6845d600.tar.gz otp-e1e8233759f835025f15da302f2a37ff6845d600.tar.bz2 otp-e1e8233759f835025f15da302f2a37ff6845d600.zip |
inets: Add peer_cert to ESI environment
Diffstat (limited to 'lib/inets/src/http_server/httpd_example.erl')
-rw-r--r-- | lib/inets/src/http_server/httpd_example.erl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/inets/src/http_server/httpd_example.erl b/lib/inets/src/http_server/httpd_example.erl index 0222487a4b..ad29b5b29a 100644 --- a/lib/inets/src/http_server/httpd_example.erl +++ b/lib/inets/src/http_server/httpd_example.erl @@ -20,7 +20,7 @@ %% -module(httpd_example). -export([print/1]). --export([get/2, post/2, yahoo/2, test1/2, get_bin/2]). +-export([get/2, post/2, yahoo/2, test1/2, get_bin/2, peer/2]). -export([newformat/3]). %% These are used by the inets test-suite @@ -94,10 +94,26 @@ default(Env,Input) -> io_lib:format("~p",[httpd:parse_query(Input)]),"\n", footer()]. +peer(Env, Input) -> + Header = + case proplists:get_value(peer_cert, Env) of + undefined -> + header("text/html", "Peer-Cert-Exist:false"); + _ -> + header("text/html", "Peer-Cert-Exist:true") + end, + [Header, + top("Test peer_cert environment option"), + "<B>Peer cert:</B> ", + io_lib:format("~p",[proplists:get_value(peer_cert, Env)]),"\n", + footer()]. + header() -> header("text/html"). header(MimeType) -> "Content-type: " ++ MimeType ++ "\r\n\r\n". +header(MimeType, Other) -> + "Content-type: " ++ MimeType ++ "\r\n" ++ Other ++ "\r\n\r\n". top(Title) -> "<HTML> |