Skip to content

get_auto_url doesn't work with unix sockets #4345

Open

Description

Image for: Description

Not sure if this is a bug report or a feature request, but after upgrading to Ubuntu 24.04 and ejabberd 23.10 I tried to use a unix socket with ejabberd_http because it is behind nginx and there is no point in using TCP:

listen:
  -
    port: "unix://run/ejabberd/ejabberd_http.socket"
    unix_socket:
      mode: "0660"
    module: ejabberd_http
    tls: false  # handled by nginx
    request_handlers:
      /bosh: mod_bosh
      /captcha: ejabberd_captcha
      /upload: mod_http_upload
      /ws: ejabberd_http_ws
      /admin: ejabberd_web_admin

Unfortunately, this doesn't work:

[error] CRASH REPORT:
  crasher:
ejabberd_captcha:init/1
<0.392.0>
[]
bad argument
      in function  integer_to_binary/1
         called as integer_to_binary(<<"unix://run/ejabberd/ejabberd_http.socket">>)
not an integer
      in call from ejabberd_captcha:get_auto_url/3 (ejabberd_captcha.erl, line 515)
      in call from ejabberd_captcha:maybe_warning_norequesthandler/0 (ejabberd_captcha.erl, line 456)
      in call from ejabberd_captcha:get_prog_name/0 (ejabberd_captcha.erl, line 450)
      in call from ejabberd_captcha:is_feature_available/0 (ejabberd_captcha.erl, line 617)
      in call from ejabberd_captcha:check_captcha_setup/0 (ejabberd_captcha.erl, line 624)
      in call from ejabberd_captcha:init/1 (ejabberd_captcha.erl, line 294)
      in call from gen_server:init_it/2 (gen_server.erl, line 851)

I see two get_auto_url functions in the ejabberd code, both require Port to be an integer:

Is it technically possible to refactor get_auto_url so that I manually set the base url so that it no longer tries to interpret Port as an integer?

I already did this for captcha and http upload, but it would be nice to configure the whole ejabberd_http module.

modules:
  mod_http_upload:
    put_url: "https://xmpp.andreymal.org/upload"
    get_url: "https://xmpp.andreymal.org/files"

captcha_url: "https://xmpp.andreymal.org/captcha"

Metadata

Image for: Metadata

Metadata

Image for: Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Image for: Issue actions