[ejabberd] mod_rest

Badlop badlop at gmail.com
Wed Aug 30 12:29:18 MSK 2017


On 24 August 2017 at 21:50, Ricky Gutierrez <xserverlinux at gmail.com> wrote:
> Look when i do the test
>
> curl  http://mydomain:5285/rest -v -d '<message to=“ricardog at mydomain>  from=“admin at mydomain/rest"><body>el cielo es real</body></message>'
>

Those “ characters inside the stanza are not acceptable.
If you configure loglevel to 5, then you would see in the log file:

11:27:31.939 [debug] Error when processing REST request:
Data: <<60,109,101,115,115,97,103...
Error: {badmatch,{error,{4,<<"not well-formed (invalid token)">>}}}

Try this instead, notice the " characters are the ASCII ones, and this
time it works:

$ curl  http://mydomain:5285/rest/ -v -d '<message
to="ricardog at mydomain" from="admin at mydomain/rest"><body>el cielo es
real</body></message>'
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to mydomain (127.0.0.1) port 5285 (#0)
> POST /rest/ HTTP/1.1
> Host: mydomain:5285
> User-Agent: curl/7.51.0
> Accept: */*
> Content-Length: 98
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 98 out of 98 bytes
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 2
<
* Curl_http_done: called premature == 0
* Connection #0 to host mydomain left intact
Ok


---
Badlop
ProcessOne


More information about the ejabberd mailing list