Skip to content

Commit

Permalink
allow Server header customization (capflam)
Browse files Browse the repository at this point in the history
Add the server_signature directive in the global part of configuration
to allow users to customize the HTTP Server header.
  • Loading branch information
Christopher Faulet authored and vinoski committed May 24, 2011
1 parent c650d77 commit e014400
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/yaws.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,10 @@ \section{Global Part}

The default value for logdir is "."

\item \verb+server_signature = String+ -
This directive set the "Server: " output header to the custom
value. The default value is "yaws/VSN, Yet Another Web Server".

\item \verb+ebin_dir = Directory+ -
This directive adds Directory to the \Erlang\ search
path. It is possible to have several of these command
Expand Down
5 changes: 5 additions & 0 deletions man/yaws.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ identity of the server. Yaws also creates a file called
${VARDIR}/run/yaws/ctl-${ID} which contain the port number where the server is
listening for control commands. The default id is "default".

.TP
\fBserver_signature = String\fR
This directive set the "Server: " output header to the custom value. The default
value is "yaws/%VSN%, Yet Another Web Server".

.TP
\fBinclude_dir = Directory\fR
This directive adds Directory to the path of directories where the Erlang
Expand Down
2 changes: 1 addition & 1 deletion src/yaws.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ make_allow_header(Options) ->
end.
make_server_header() ->
HasDav = ?sc_has_dav(get(sc)),
["Server: Yaws/", yaws_generated:version(), " Yet Another Web Server\r\n" |
["Server: ", (get(gc))#gconf.yaws, "\r\n" |
if HasDav == true ->
["DAV: 1\r\n"];
true ->
Expand Down
2 changes: 2 additions & 0 deletions src/yaws_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
Ysession_mod = list_to_atom(Mod_str),
fload(FD, globals, GC#gconf{ysession_mod = Ysession_mod},
C, Cs, Lno+1, Next);
["server_signature", '=', Signature] ->
fload(FD, globals, GC#gconf{yaws=Signature},C, Cs, Lno+1, Next);
['<', "server", Server, '>'] -> %% first server
PhpHandler = {cgi, GC#gconf.phpexe},
fload(FD, server, GC,
Expand Down

0 comments on commit e014400

Please sign in to comment.