On Fri, Jan 14, 2011 at 12:14 AM, mayamatakeshi <mayamatakeshi@gmail.com> wrote:
Hello,
can someone give me a sample of calling to xhttp from curl or wget?

I have this in my kamailio.cfg:


listen=tcp:192.168.2.105:80

loadmodule "xhttp.so"

event_route[xhttp:request] {
    xhttp_reply("200", "OK", "text/html",
        "<html><body>OK - [$si:$sp]</body></html>");
}


But when I try wget or curl, kamailio closes the connection without sending a response:

[root@centos55-02105 tmp]# curl http://192.168.2.105/test
curl: (52) Empty reply from server

[root@centos55-02105 tmp]# wget http://192.168.2.105/test
--2011-01-14 00:11:49--  http://192.168.2.105/test
Connecting to 192.168.2.105:80... connected.
HTTP request sent, awaiting response... No data received.


I see this in the log file:

Jan 14 00:04:47 centos55-02105 /usr/local/sbin/kamailio[10479]: ERROR: <core> [tcp_read.c:904]: ERROR: tcp_read_req: bad request, state=7, error=4 buf: GET /test HTTP/1.0^M User-Agent: Wget/1.11.4 Red Hat modified^M Accept: */*^M Host: 192.168.2.105^M Connection: Keep-Alive^M ^M  parsed: GET /test HTTP/1.0^M User-Agent: Wget/1.11.4 Red Hat modified^M Accept: */*^M Host: 192.168.2.105^M Connection: Keep-Alive^M ^M

Nevermind.
I got it. It must be a POST request:

 wget --post-data="abc" http://192.168.2.105/test

thanks,
takeshi