Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

probably a bug #27

Open
Rom4eg opened this issue Jul 1, 2015 · 0 comments
Open

probably a bug #27

Rom4eg opened this issue Jul 1, 2015 · 0 comments

Comments

@Rom4eg
Copy link

Rom4eg commented Jul 1, 2015

I'm using ejabberd 15.04 and CentOS

config:

mod_restful:
    api:
      - path: ["admin"]
        module: mod_restful_admin
        params:
          key: "secret"
          allowed_commands: [register, unregister, change_password, get_vcard]
      - path: ["register"]
        module: mod_restful_register
        params:
          key: "secret"

POST request:

url:
    http://localhost:8088/api/admin

headers:
    CSP: active
    Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
    User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36
    Content-Type: application/json 
    Accept: */*    
    DNT: 1
    Accept-Encoding: gzip, deflate
    Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4

body:
    {"args": ["some_login", "guest.example.ru", "FN"], "command": "get_vcard", "key": "secret"}

error:

[error] <0.795.0> Processing throwed error badarg
trace: [{erlang,list_to_binary,[<<"Test_Name">>],[]},{mod_restful_admin,format_result_json,2,[{file,"src/mod_restful_admin.erl"},{line,188}]},
{mod_restful_admin,format_result,3,[{file,"src/mod_restful_admin.erl"},{line,176}]},
{mod_restful_admin,do_process,1,[{file,"src/mod_restful_admin.erl"},{line,89}]},
{mod_restful,handle_rest_request,5,[{file,"src/mod_restful.erl"},{line,193}]},
{mod_restful,process,2,[{file,"src/mod_restful.erl"},{line,161}]},
{ejabberd_http,process,5,[{file,"src/ejabberd_http.erl"},{line,365}]},
{ejabberd_http,process_request,1,[{file,"src/ejabberd_http.erl"},{line,449}]}]

to reproduce the error:

  1. Change "Full Name" from xmpp client(i'm using pidgin)
  2. Send request

You've get BadRequest.

I'm test it in chrome extension "Advanced REST client", Python script, and wget (Linux utility) and I always get the same result(error in ejabberd.log).

"Test_Name" In first block it's a vcard "Full Name" - that I changed via pidgin before request.

Other similar requests like "register" "unregister, etc." work's fine, but those commands is a part of mod_admin module. Maybe it's because get_vcard is a part of mod_admin_extra and it's output has a different format?

@Rom4eg Rom4eg changed the title probably a bug in command get_vcard probably a bug Jul 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant