Code Monkey home page Code Monkey logo

mod-http-pre-bind's Introduction

mod_http_pre_bind for ejabberd. 

When using anonymous users the authentication process through BOSH can
take a second or two.  These seconds can be saved by doing all of the
authentication and bosh session setup on one call. mod_http_pre_bind
does this and returns a jid, sid, and rid of a valid BOSH session.

It requires mod_http_bind.  Modifications are needed to
src/web/ejabberd_http_bind.erl. The start, http_get, http_put,
handle_session_start, and prepare_response functions need to be made
public in the module code.  This prebind module simply calls those
functions to initiate and handle a session.

To build run the build.sh script and install the resulting beam files
in your ejabberd ebin directory.

Install both in ejabberd.cfg.


{5288, ejabberd_http, [
                         http_bind, 
                         web_admin,
                         {request_handlers, 
                          [{["http-pre-bind"], 
                            mod_http_pre_bind}]}
                        ]}


%%
%% Modules enabled in all ejabberd virtual hosts.
%%
{modules,
 [
  {mod_http_bind,      []},
  {mod_http_pre_bind,      []},


Example post and response:

POST
<body to='example.com' rid='1234567' wait='60' hold='1' />



Response:
 <body xmlns='http://jabber.org/protocol/httpbind'   
       sid='892efca20cea238958f0603f89a6f8472ef790fe'   
       rid='1234568'>  
   <iq xmlns='jabber:client'  
       id='_bind_auth_2'  
       type='result'>  
     <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>  
       <jid>[email protected]/37436661951260831658614586</jid>  
     </bind>  
   </iq>  
</body>

mod-http-pre-bind's People

Contributors

skinkie avatar thepug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mod-http-pre-bind's Issues

This mod still work ?

Hi,
I'm trying to enable pre-binding without success.

I'm running Archlinux & latest Ejabberd/ERLANG. Do you think it's still working ? this mod looks old :(
-> Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]
-> ejabberd 2.1.11-7

Here the ejabberd trace

[root@foo-arch playdoria]# tail -f /var/log/ejabberd/ejabberd.log 
=INFO REPORT==== 2012-12-05 13:46:44 ===
I(<0.37.0>:cyrsasl_digest:44) : FQDN used to check DIGEST-MD5 SASL authentication: "localhost.localdomain"

=ERROR REPORT==== 2012-12-05 13:46:44 ===
C(<0.37.0>:gen_mod:75) : Problem starting the module mod_http_pre_bind for host "foo.playdoria.com" 
 options: []
 error: undef

=ERROR REPORT==== 2012-12-05 13:46:44 ===
C(<0.37.0>:gen_mod:80) : ejabberd initialization was aborted because a module start failed.

I am using ejabberd since few days and I'm not very comfortable with ERLANG, any help would be really appreciated.

Realuser support

One of the comments in the source code is to support 'realusers'. What should be implemented to support them. In terms of complexity, is this difficult?

Compiling error

I am getting can't find include file "ejabberd.hrl" and a few other include file error.

I know that I have to point this to include the files, but how? Should I copy this to my ejabberd src folder? Because that is where the include files reside.

Empty responses

I installed the pre-bind module as instruvted. The GET handler works as expected, but when I try the to get a new session with

curl -d "<body to='jabber.my.tld' rid='1234567' wait='60' hold='1' />" http://localhost:5280/http-pre-bind/

I only get empty responses.

The log file does not help either:


=INFO REPORT==== 2012-06-24 23:00:11 ===
I(<0.365.0>:ejabberd_listener:232) : (#Port<0.3011>) Accepted connection {{192,168,2,10},48274} -> {{192,168,2,10},5280}

=INFO REPORT==== 2012-06-24 23:00:11 ===
I(<0.395.0>:ejabberd_http:138) : started: {gen_tcp,#Port<0.3011>}

=INFO REPORT==== 2012-06-24 23:00:42 ===
I(<0.396.0>:ejabberd_http_bind:508) : Session timeout. Closing the HTTP bind session: "d408f8688f03d57f9870481b423ff9bc2b7d298f"

undefined function mod_http_pre_bind:process/2

I keep getting empty responses when trying to authenticate new users. The reason apparently is this crash:


=CRASH REPORT==== 24-Jun-2012::22:42:30 ===
  crasher:
    initial call: ejabberd_http:init/2
    pid: <0.415.0>
    registered_name: []
    exception error: undefined function mod_http_pre_bind:process/2
      in function  ejabberd_http:process/2
      in call from ejabberd_http:process_request/1
      in call from ejabberd_http:process_header/2
      in call from ejabberd_http:receive_headers/1
    ancestors: [ejabberd_http_sup,ejabberd_sup,<0.37.0>]
    messages: []
    links: [<0.275.0>,#Port<0.3349>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 1597
    stack_size: 24
    reductions: 726
  neighbours:

=SUPERVISOR REPORT==== 24-Jun-2012::22:42:30 ===
     Supervisor: {local,ejabberd_http_sup}
     Context:    child_terminated
     Reason:     undef
     Offender:   [{pid,<0.415.0>},
                  {name,undefined},
                  {mfargs,
                      {ejabberd_http,start_link,
                          [{gen_tcp,#Port<0.3349>},
                           [inet,http_bind,http_poll,http_prebind,web_admin,
                            {request_handlers,
                                [{["http-pre-bind"],mod_http_pre_bind}]},
                            {ip,{0,0,0,0}}]]}},
                  {restart_type,temporary},
                  {shutdown,brutal_kill},
                  {child_type,worker}]

Am I doing something wrong?

ejabberd:
Installed: 2.1.5-3+squeeze1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.