Skip to content

Instantly share code, notes, and snippets.

@juvenn
Created January 21, 2010 15:29
Show Gist options
  • Save juvenn/282876 to your computer and use it in GitHub Desktop.
Save juvenn/282876 to your computer and use it in GitHub Desktop.
The error must be caused by exmpp_jid:to_lower("").
I suspect the problem is, after superfeedr authorized my request with:
<iq type="result" id="auth" />
it sends a
<presence />
without attributions.
Then exmpp will get JidString="", then it will invoke
exmpp_jid:to_lower(JidString). But exmpp_jid:to_lower does not expect the value,
thus mis-handles it.
>c(pubsub).
>pubsub:connect().
ok
=ERROR REPORT==== 21-Jan-2010::21:27:26 ===
** State machine <0.149.0> terminating
** Last event in was {xmlstreamelement,
{xmlel,'jabber:client',[],presence,[],[]}}
** When State == logged_in
** Data == {state,
{basic,password,
{jid,<<"user@superfeedr.com/jkckjdsi">>,
<<"user">>,<<"superfeedr.com">>,<<"jkckjdsi">>},
"secret"},
{0,0},
false,"superfeedr.com",<0.143.0>,exmpp_tcp,#Port<0.3471>,
{xml_stream,
{gen_fsm,<0.149.0>},
{xml_parser,
[{max_size,infinity},
{root_depth,1},
{names_as_atom,true},
{emit_endtag,true},
{check_nss,xmpp},
{check_elems,xmpp},
{check_attrs,xmpp}],
#Port<0.3470>},
new,false,undefined},
"370793910",undefined,<0.150.0>,undefined}
** Reason for termination =
** {bad_return_value,{jid,parse,unexpected_end_of_string,{jid,[]}}}
** exception error: {bad_return_value,{jid,parse,unexpected_end_of_string,
{jid,[]}}}
%% exmpp version 0.9.2
-module(pubsub).
-export([connect/0]).
connect() ->
exmpp:start(),
MySession = exmpp_session:start_link(),
Jid = exmpp_jid:make("user","superfeedr.com",random),
exmpp_session:auth_basic(MySession,Jid,"secret"),
{ok,_} = exmpp_session:connect_TCP(MySession,"xmpp.superfeedr.com",5222),
exmpp_session:login(MySession).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment