Actually,
On a second thought, it doesn't look like you send test.xml at all. I cannot
believe that curl miscalculates the length. Therefore a simple tcpdump, as
first asked, or (2) which will show what kannel receives should settle this.
BR,
Nikos
----- Original Message -----
From: "Nikos Balkanas" <[email protected]>
To: "Francis Vidal" <[email protected]>; <[email protected]>
Sent: Tuesday, December 16, 2008 7:44 AM
Subject: Re: Authorization failed for XML post
Dear Francis,
I see a possible problem by Curl. In POST it sends Content-Length: 17,
when the length of the xml file > 50. This normally would lead to broken
requests (bad requests), but since 17 characters end before the <user>
credentials maybe it leads lto Forbidden access. This is further supported
from bearerbox logs. It is not rejected by smsbox (server failed access),
but after parsing the XML, bearerbox rejects it and generates 403.
3 things:
1) Remove all credentials from your configure file and XML and run the
POST again. If possible get tcpdump, to capture exactly what curl sents.
Expect to fail but with a different cause.
2) You need better logs. Reenable credentials & please run:
script
bearerbox <conffile> &
smsbox <conffile> &
In another terminal run the curl POST w/credentials.
3) Test by hand:
telnet 127.0.0.1 8081
POST /cgi-bin/sendsms HTTP/1.1
Host: localhost:8081
Content-Length: 270 <verify length by
yourself. Every new line is 2 characters (\r\n)>
Content-type: text/html
<?xml version="1.0" encoding="ISO-8859-1"?>
<message>
<submit>
<da><number>the_number</number></da>
<ud>Another+test+sms</ud>
<!-- request from Kannel to application -->
<from>
<user>user</user>
<pass>user</pass>
</from>
</submit>
</message>
Let me know how it goes,
Nikos
----- Original Message -----
From: "Francis Vidal" <[email protected]>
To: <[email protected]>
Sent: Tuesday, December 16, 2008 6:20 AM
Subject: Re: Authorization failed for XML post
/var/log/kannel/smsbox.log:
2008-12-16 12:14:49 [4507] [2] DEBUG: HTTP: Creating HTTPClient for
`127.0.0.1'.
2008-12-16 12:14:49 [4507] [2] DEBUG: HTTP: Created HTTPClient area
0x97aefd0.
2008-12-16 12:14:49 [4507] [3] INFO: smsbox: Got HTTP request
</cgi-bin/sendsms> from <127.0.0.1>
2008-12-16 12:14:49 [4507] [3] INFO: sendsms used by <user>
2008-12-16 12:14:49 [4507] [3] INFO: sendsms
sender:<user:+xxxxxxxxxxxx> (127.0.0.1) to:<+xxxxxxxxxxxx> msg:<Hello
world>
2008-12-16 12:14:49 [4507] [3] DEBUG: Stored UUID
e6669b3d-6b61-4956-a9ae-24d302a395cc
2008-12-16 12:14:49 [4507] [3] DEBUG: message length 11, sending 1
messages
2008-12-16 12:14:49 [4507] [3] DEBUG: Status: 202 Answer: <Sent.>
2008-12-16 12:14:49 [4507] [3] DEBUG: Delayed reply - wait for bearerbox
2008-12-16 12:14:49 [4507] [0] DEBUG: Got ACK (0) of
e6669b3d-6b61-4956-a9ae-24d302a395cc
2008-12-16 12:14:49 [4507] [0] DEBUG: HTTP: Resetting HTTPClient for
`127.0.0.1'.
2008-12-16 12:14:49 [4507] [1] DEBUG: HTTP: Destroying HTTPClient area
0x97aefd0.
2008-12-16 12:14:49 [4507] [1] DEBUG: HTTP: Destroying HTTPClient for
`127.0.0.1'.
CURL output (verbose):
curl -v
"http://localhost:8081/cgi-bin/sendsms?user=user&pass=user&to=09213116180&text=Hello+world"
* About to connect() to localhost port 8081 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8081 (#0)
GET /cgi-bin/sendsms?user=user&pass=user&to=09213116180&text=Hello+world
HTTP/1.1
User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2
OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8
Host: localhost:8081
Accept: */*
< HTTP/1.1 202 Accepted
< Server: Kannel/1.4.1
< Content-Length: 24
< Content-type: text/html
< Pragma: no-cache
< Cache-Control: no-cache
<
* Connection #0 to host localhost left intact
* Closing connection #0
0: Accepted for delivery
On Mon, Dec 15, 2008 at 6:37 PM, Nikos Balkanas <[email protected]>
wrote:
This is more informative than the bearerbox logs. I imagine nothing
interesting on smsbox logs, right?
Could you post your configuration, and the CURL output from your
(succesful)
GET operation? Seems like your URL is not what kannel expects.
BR,
Nikos
----- Original Message ----- From: "Francis Vidal"
<[email protected]>
To: "seikath" <[email protected]>
Cc: <[email protected]>
Sent: Monday, December 15, 2008 11:21 AM
Subject: Re: Authorization failed for XML post
Okay, tried adding "?username=user&password=pass" to the URL:
curl -v -H "Content-type: text/xm
localhost:8081/cgi-bin/sendsms?username=user&password=user"
Here's the output of CURL:
* About to connect() to localhost port 8081 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8081 (#0)
POST /cgi-bin/sendsms?username=user&password=user HTTP/1.1
User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2
OpenSSL/0.9.8g
zlib/1.2.3.3 libidn/1.8
Host: localhost:8081
Accept: */*
Content-type: text/xml
Content-Length: 17
< HTTP/1.1 403 Forbidden
< Server: Kannel/1.4.1
< Content-Length: 32
< Content-type: text/html
< Pragma: no-cache
< Cache-Control: no-cache
<
* Connection #0 to host localhost left intact
* Closing connection #0
Authorization failed for sendsms
On Mon, Dec 15, 2008 at 4:20 PM, seikath <[email protected]> wrote:
for the curl XML POST request try use the same URL with the
user&password added
Francis Vidal wrote:
Hi all,
I'm trying to send a test SMS message using CURL:
curl -v -H "Content-type: text/xml" -d test.xml
http://localhost:8081/cgi-bin/sendsms
Here's the content of test.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<message>
<submit>
<da><number>the_number</number></da>
<ud>Another+test+sms</ud>
<!-- request from Kannel to application -->
<from>
<user>user</user>
<pass>user</pass>
</from>
</submit>
</message>
I can send SMS using the normal HTTP method (i.e.
http://localhost:8081/cgi-bin/sendsms?user=user&pass=user&...) but
when I use the CURL method above, I get "Authorization failed". What
am I doing wrong?