diff options
| author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-10-05 11:33:29 +0300 | 
|---|---|---|
| committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-10-05 11:33:29 +0300 | 
| commit | 6f922275ebcf130e982198e6108212c5f5778e4e (patch) | |
| tree | 939ddb5aaae5dff03add79829baed3c3fd3f80d7 | |
| parent | Log request in access.log even when Host doesn't match (diff) | |
Improve logging of mismatched Hosts
| -rw-r--r-- | src/mod_http_fileserver.erl | 6 | 
1 files changed, 4 insertions, 2 deletions
| diff --git a/src/mod_http_fileserver.erl b/src/mod_http_fileserver.erl index a3a49eef0..73423d6a7 100644 --- a/src/mod_http_fileserver.erl +++ b/src/mod_http_fileserver.erl @@ -66,6 +66,8 @@  	{-1, 403, [], <<"Forbidden">>}).  -define(HTTP_ERR_REQUEST_AUTH,  	{-1, 401, ?REQUEST_AUTH_HEADERS, <<"Unauthorized">>}). +-define(HTTP_ERR_HOST_UNKNOWN, +	{-1, 410, [], <<"Host unknown">>}).  -define(DEFAULT_CONTENT_TYPE,  	<<"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, "  		   "but couldn't find the related "  		   "ejabberd virtual host", [Host]), -	    {FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_FILE_NOT_FOUND, -	    add_to_log(FileSize1, Code1, Request), +	    {FileSize1, Code1, Headers1, Contents1} = ?HTTP_ERR_HOST_UNKNOWN, +	    add_to_log(FileSize1, Code1, Request#request{host = ?MYNAME}),  	    {Code1, Headers1, Contents1}      end. | 
