25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Improve logging of mismatched Hosts

This commit is contained in:
Evgeniy Khramtsov 2017-10-05 11:33:29 +03:00
parent 94de13981b
commit 6f922275eb

View File

@ -66,6 +66,8 @@
{-1, 403, [], <<"Forbidden">>}). {-1, 403, [], <<"Forbidden">>}).
-define(HTTP_ERR_REQUEST_AUTH, -define(HTTP_ERR_REQUEST_AUTH,
{-1, 401, ?REQUEST_AUTH_HEADERS, <<"Unauthorized">>}). {-1, 401, ?REQUEST_AUTH_HEADERS, <<"Unauthorized">>}).
-define(HTTP_ERR_HOST_UNKNOWN,
{-1, 410, [], <<"Host unknown">>}).
-define(DEFAULT_CONTENT_TYPE, -define(DEFAULT_CONTENT_TYPE,
<<"application/octet-stream">>). <<"application/octet-stream">>).
@ -313,8 +315,8 @@ process(LocalPath, #request{host = Host, auth = Auth, headers = RHeaders} = Requ
?DEBUG("Received an HTTP request with Host: ~s, " ?DEBUG("Received an HTTP request with Host: ~s, "
"but couldn't find the related " "but couldn't find the related "
"ejabberd virtual host", [Host]), "ejabberd virtual host", [Host]),
{FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_FILE_NOT_FOUND, {FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_HOST_UNKNOWN,
add_to_log(FileSize1, Code1, Request), add_to_log(FileSize1, Code1, Request#request{host = ?MYNAME}),
{Code1, Headers1, Contents1} {Code1, Headers1, Contents1}
end. end.