ejabberd-2.0.0 from src on Centos5 - empty responses from mod_http_fileserver?

Hello all,

I've been using the ejabberd-2.0.0 binary release happily on Centos5 but recently had to compile from src to enable full xml support.

Now I'm only getting empty responses from requests serviced by mod_http_fileserver:

MC-S001723:~ woodm05$ curl http://ec2-75-101-226-202.compute-1.amazonaws.com/www/index.html
curl: (52) Empty reply from server

(Though a request for '.../www/' returns the 'elsdir' response as expected...)

Things look good in the log:
=INFO REPORT==== 2008-05-05 07:05:50 ===
D(<0.251.0>:ejabberd_http:121) : S: [{["www"],mod_http_fileserver},
{["admin"],ejabberd_web_admin},
{["http-bind"],mod_http_bind},
{["http-poll"],ejabberd_http_poll}]

=INFO REPORT==== 2008-05-05 07:05:50 ===
I(<0.251.0>:ejabberd_http:123) : started: {gen_tcp,#Port<0.427>}

=INFO REPORT==== 2008-05-05 07:05:50 ===
D(<0.354.0>:ejabberd_http:224) : (#Port<0.427>) http query: 'GET' /www/index.html

=INFO REPORT==== 2008-05-05 07:05:50 ===
D(<0.354.0>:ejabberd_http:263) : ["www","index.html"] matches ["www"]

=INFO REPORT==== 2008-05-05 07:05:50 ===
D(<0.354.0>:mod_http_fileserver:54) : Requested ["index.html"]

=INFO REPORT==== 2008-05-05 07:05:50 ===
D(<0.354.0>:mod_http_fileserver:71) : Delivering content.

If it helps here are the relevant conf snippets:

...
{80, ejabberd_http, [
...
{request_handlers, [
{["www"], mod_http_fileserver}
]
}
...
]}.
...
{mod_http_fileserver, [{docroot, "/var/www"}]},
...

And I can confirm that the requested file exists and is non-empty:

[root@domU-12-31-39-00-EE-51:~] ls -al /var/www
total 12
drwxr-xr-x 2 root root 4096 May 5 07:13 .
drwxr-xr-x 21 root root 4096 May 5 06:28 ..
-rw-r--r-- 1 root root 43 May 5 07:13 index.html

I compiled ejabberd using the stock Centos5 erlang, version R11B-2.3.el5.

Any clues on how to investigate this further would be appreciated - I'm really hoping I've missed something obvious!

Check log files at starttime; try this debug line

Check ejabberd log files (ejabberd.log and sasl.log) when ejabberd is started: maybe there is an error reported, only when ejabberd is starting.

To know what file is read, and what is the content read, you can replace in mod_http_fileserver.erl the line:

?DEBUG("Delivering content.", []),

with this one:

?DEBUG("Delivering the file ~p with content:~n ~p", [FileName, FileContents]),

File is read OK, but not served...

Thanks for such a prompt reply.

I checked both logs but there are no startup errors.

I also hacked in your trace code and it looks like the file is being read fine:
=INFO REPORT==== 2008-05-05 17:34:17 ===
D(<0.350.0>:ejabberd_http:263) : ["www","index.html"] matches ["www"]

=INFO REPORT==== 2008-05-05 17:34:17 ===
D(<0.350.0>:mod_http_fileserver:54) : Requested ["index.html"]

=INFO REPORT==== 2008-05-05 17:34:17 ===
D(<0.350.0>:mod_http_fileserver:71) : Delivering the file "/var/www/index.html" with content:
<<"i am not empty\n\n\n">>

But my curl is still failing :-(
[root@domU-12-31-39-00-EE-51:/opt/var/log/ejabberd] curl http://localhost/www/index.html
curl: (52) Empty reply from server

Watching tcpdump I can see a response to the GET, but no content:
17:34:31.800653 IP localhost.48570 > localhost.http: P 1:166(165) ack 1 win 8192
0x0000: 4500 00d9 b701 4000 4006 851b 7f00 0001 E.....@.@.......
0x0010: 7f00 0001 bdba 0050 0a38 4424 09fa 7b39 .......P.8D$..{9
0x0020: 8018 2000 fecd 0000 0101 080a 003e f2dc .............>..
0x0030: 003e f2dc 4745 5420 2f77 7777 2f69 6e64 .>..GET./www/ind
0x0040: 6578 2e68 746d 6c20 4854 5450 2f31 2e31 ex.html.HTTP/1.1
0x0050: 0d0a ..
17:34:31.800662 IP localhost.http > localhost.48570: . ack 166 win 8150
0x0000: 4500 0034 89e5 4000 4006 b2dc 7f00 0001 E..4..@.@.......
0x0010: 7f00 0001 0050 bdba 09fa 7b39 0a38 44c9 .....P....{9.8D.
0x0020: 8010 1fd6 e06f 0000 0101 080a 003e f2dc .....o.......>..
0x0030: 003e f2dc .>..
17:34:31.801259 IP localhost.http > localhost.48570: F 1:1(0) ack 166 win 8150
0x0000: 4500 0034 89e6 4000 4006 b2db 7f00 0001 E..4..@.@.......
0x0010: 7f00 0001 0050 bdba 09fa 7b39 0a38 44c9 .....P....{9.8D.
0x0020: 8011 1fd6 e06e 0000 0101 080a 003e f2dc .....n.......>..
0x0030: 003e f2dc .>..
17:34:31.803797 IP localhost.48570 > localhost.http: F 166:166(0) ack 2 win 8192
0x0000: 4500 0034 b702 4000 4006 85bf 7f00 0001 E..4..@.@.......
0x0010: 7f00 0001 bdba 0050 0a38 44c9 09fa 7b3a .......P.8D...{:
0x0020: 8011 2000 e043 0000 0101 080a 003e f2dc .....C.......>..
0x0030: 003e f2dc .>..
17:34:31.803806 IP localhost.http > localhost.48570: . ack 167 win 8150
0x0000: 4500 0034 89e7 4000 4006 b2da 7f00 0001 E..4..@.@.......
0x0010: 7f00 0001 0050 bdba 09fa 7b3a 0a38 44ca .....P....{:.8D.
0x0020: 8010 1fd6 e06d 0000 0101 080a 003e f2dc .....m.......>..
0x0030: 003e f2dc .>..

How puzzling! Any more clues? I'm very happy to try and help track this down, but I am getting towards the limits of my ingenuity...

string:to_lower?

I've been doing a little more digging - is it possible that string:to_lower isn't included in the R11B-2.3.el5 erlang package I'm using...?

Right, mod_http_fileserver in ejabberd 2.0.0 requires Erlang R11

Anonymous wrote:

is it possible that string:to_lower isn't included in the R11B-2.3.el5 erlang package I'm using...?

You are right, the function string:to_lower was introduced in Erlang R11B-4. This function is used in mod_http_fileserver (included in ejabberd 2.0.0) and in the contributed module mod_muc_log_http.

However, ejabberd 2.0.0 requirements in the guide say: Erlang/OTP R10B-9 up to R11B-5.

The better solution for you is to update to Erlang R11B-5. If you can't do that, you can replace the calls 'string:to_lower' with 'httpd_util:to_lower'.

Thanks for your report, I'll fix this for ejabberd 2.0.1.

The problem is reported

FIXED - used a newer version of erlang

I removed the stock CentOS erlang and recompiled ejabberd against a from-source erlang version otp_src_R11B-5.

http works fine again - do the ejabberd build reqs need to be changed?

Syndicate content