summaryrefslogtreecommitdiff
path: root/src/chttpd/src/chttpd.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/chttpd/src/chttpd.erl')
-rw-r--r--src/chttpd/src/chttpd.erl21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index b11338eef..8fd05597d 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -57,6 +57,9 @@
buffer_response=false
}).
+-define(DEFAULT_SERVER_OPTIONS, "[{recbuf, undefined}]").
+-define(DEFAULT_SOCKET_OPTIONS, "[{sndbuf, 262144}, {nodelay, true}]").
+
start_link() ->
start_link(http).
start_link(http) ->
@@ -141,7 +144,12 @@ start_link(Name, Options) ->
end.
get_server_options(Module) ->
- ServerOptsCfg = config:get(Module, "server_options", "[]"),
+ ServerOptsCfg =
+ case Module of
+ "chttpd" -> config:get(Module,
+ "server_options", ?DEFAULT_SERVER_OPTIONS);
+ _ -> config:get(Module, "server_options", "[]")
+ end,
{ok, ServerOpts} = couch_util:parse_term(ServerOptsCfg),
ServerOpts.
@@ -159,13 +167,10 @@ handle_request(MochiReq0) ->
handle_request_int(MochiReq) ->
Begin = os:timestamp(),
- case config:get("chttpd", "socket_options") of
- undefined ->
- ok;
- SocketOptsCfg ->
- {ok, SocketOpts} = couch_util:parse_term(SocketOptsCfg),
- ok = mochiweb_socket:setopts(MochiReq:get(socket), SocketOpts)
- end,
+ SocketOptsCfg = config:get(
+ "chttpd", "socket_options", ?DEFAULT_SOCKET_OPTIONS),
+ {ok, SocketOpts} = couch_util:parse_term(SocketOptsCfg),
+ ok = mochiweb_socket:setopts(MochiReq:get(socket), SocketOpts),
% for the path, use the raw path with the query string and fragment
% removed, but URL quoting left intact