aboutsummaryrefslogtreecommitdiff
path: root/src/web/ejabberd_http.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2011-04-12 23:31:08 +0200
committerBadlop <badlop@process-one.net>2011-04-12 23:31:08 +0200
commit70bf5b4edadab95c50f377b859752f41d32e05e3 (patch)
treea5f7abfe9cd36f8f72bc1fd5a75d4f91659c7166 /src/web/ejabberd_http.erl
parentSupport as read-only HTTP method not only GET, also HEAD (diff)
The responses to HEAD must have empty Body
Diffstat (limited to 'src/web/ejabberd_http.erl')
-rw-r--r--src/web/ejabberd_http.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/web/ejabberd_http.erl b/src/web/ejabberd_http.erl
index ef370eb99..ea6851902 100644
--- a/src/web/ejabberd_http.erl
+++ b/src/web/ejabberd_http.erl
@@ -557,7 +557,13 @@ make_xhtml_output(State, Status, Headers, XHTML) ->
end, HeadersOut),
SL = [Version, integer_to_list(Status), " ",
code_to_phrase(Status), "\r\n"],
- [SL, H, "\r\n", Data].
+
+ Data2 = case State#state.request_method of
+ 'HEAD' -> "";
+ _ -> Data
+ end,
+
+ [SL, H, "\r\n", Data2].
make_text_output(State, Status, Headers, Text) when is_list(Text) ->
make_text_output(State, Status, Headers, list_to_binary(Text));
@@ -594,7 +600,13 @@ make_text_output(State, Status, Headers, Data) when is_binary(Data) ->
end, HeadersOut),
SL = [Version, integer_to_list(Status), " ",
code_to_phrase(Status), "\r\n"],
- [SL, H, "\r\n", Data].
+
+ Data2 = case State#state.request_method of
+ 'HEAD' -> "";
+ _ -> Data
+ end,
+
+ [SL, H, "\r\n", Data2].
parse_lang(Langs) ->