]> granicus.if.org Git - ejabberd/commitdiff
The responses to HEAD must have empty Body
authorBadlop <badlop@process-one.net>
Tue, 12 Apr 2011 21:31:08 +0000 (23:31 +0200)
committerBadlop <badlop@process-one.net>
Wed, 13 Apr 2011 08:32:26 +0000 (10:32 +0200)
src/web/ejabberd_http.erl

index 76d9b2c0b1604d0d41357c9263c96a5628647a9a..5137d757f8b81fbd7bb309c935acc9aa55b025ba 100644 (file)
@@ -562,7 +562,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));
@@ -599,7 +605,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) ->