priyadi / roundcube-converse.js-xmpp-plugin

XMPP plugin for Roundcube Webmail based on converse.js
48 stars 18 forks source link

Caused 500 error #10

Open ghost opened 10 years ago

ghost commented 10 years ago

When it configured as needed it caused down my rouncube, when install is clean, it unable to connect to my server.

[20-Nov-2013 20:27:07] PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in /hosting/mail.encryptsend.com/roundcubemail/plugins/converse/php/xmpp-prebind-php/lib/XmppPrebind.php on line 589 [20-Nov-2013 20:27:07] PHP Fatal error: Call to a member function getAttribute() on a non-object in /hosting/mail.encryptsend.com/roundcubemail/plugins/converse/php/xmpp-prebind-php/lib/XmppPrebind.php on line 127

ghost commented 10 years ago

500 Error solved with some manipulation with config, but it still unable to connect, when i wittent login pass, it return me to login pag again

priyadi commented 10 years ago

can you provide me with your config.php?

ghost commented 10 years ago

<?php // important variables in the following anonymous functions: // $args['host'] : IMAP hostname // $args['user'] : IMAP username // $args['pass'] : IMAP password

// Hostname of BOSH endpoint, used for prebinding only (called by PHP), // this must be an absolute URL $rcmail_config['converse_xmpp_bosh_prebind_url']= function($args) { return 'http://localhost:5280/http-bind';

return sprintf('http://%s/http-bind', $_SERVER['HTTP_HOST']);

    # return sprintf('http://%s/http-bind', $args['host']);

};

// Hostname of BOSH endpoint, used by web browsers (called by Javascript code), // this can be a relative URL $rcmail_config['converse_xmpp_bosh_url']= function($args) { return '/http-bind'; };

// Hostname portion of XMPP username (bare JID), example: "example.net" $rcmail_config['converse_xmpp_hostname']= function($args) { return 'example.net';

return preg_replace('/^.*@/', '', $args['user']);

    # return $args['host'];

};

// Username portion of XMPP username (bare JID), example: "user" // if this contains @, this will only take the part before @, // and the part after @ will replace the hostname definition above. $rcmail_config['converse_xmpp_username']= function($args) { return $args['user'];

return preg_replace('/@.*$/', '', $args['user']);

};

// XMPP password $rcmail_config['converse_xmpp_password']= function($args) { return $args['pass']; };

// Always embed chat even if prebinding is not configured or failed $rcmail_config['converse_xmpp_enable_always'] = false;

// Enable debug mode $rcmail_config['converse_xmpp_debug'] = false;

// Enable development mode $rcmail_config['converse_xmpp_devel_mode'] = false;

// Use older XMPP bind code (in case someone is having problem with // newer code using Candy Chat's prebind library) $rcmail_config['converse_xmpp_old_style_prebind'] = false;

My nginx proxy to BOSH

    location /http-bind/ {
    proxy_pass https://localhost:7443/http-bind/;
    proxy_method POST;
    proxy_buffering off;
    tcp_nodelay on;

}

ghost commented 10 years ago

sorry proxy_pass http://localhost:5280/http-bind/;

priyadi commented 10 years ago

OK, your config is pretty ordinary. from your error message, this probably has something to do with your BOSH endpoint. can you try using Pidgin to connect to BOSH endpoint?

ghost commented 10 years ago

Yep, i can connect via pidgin, also jappix mini works well

priyadi commented 10 years ago

Can you provide me with BOSH logs? preferably from Roundcube login, until the error occurs. I just commited TROUBLESHOOTING.md if you need help getting BOSH logs.

priyadi commented 10 years ago

Also, what is the XMPP server you are using?

ghost commented 10 years ago

openfire

ghost commented 10 years ago

It show that all ok, any 404 or 500 error, but it not login without any errors, and shows again login page I've already used developer tool as in firefox and chrome

priyadi commented 10 years ago

in XmppPrebind.php, can you try changing the function:

        private function sendInitialConnection() {
                $domDocument = $this->buildBody();
                $body = self::getBodyFromDomDocument($domDocument);

                $waitTime = 60;

                $body->appendChild(self::getNewTextAttribute($domDocument, 'hold', '1'));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'to', $this->jabberHost));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'xmlns:xmpp', self::XMLNS_BOSH));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'xmpp:version', '1.0'));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'wait', $waitTime));

                return $this->send($domDocument->saveXML());
        }

to:

        private function sendInitialConnection() {
                $domDocument = $this->buildBody();
                $body = self::getBodyFromDomDocument($domDocument);

                $waitTime = 60;

                $body->appendChild(self::getNewTextAttribute($domDocument, 'hold', '1'));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'to', $this->jabberHost));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'xmlns:xmpp', self::XMLNS_BOSH));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'xmpp:version', '1.0'));
                $body->appendChild(self::getNewTextAttribute($domDocument, 'wait', $waitTime));
                error_log($domDocument->saveXML());
                $return = $this->send($domDocument->saveXML());
                error_log($return->saveXML());
                return $return;
        }

and paste the output from your web server log here.

ghost commented 10 years ago

as i undestood it will show error if it exist to browser?

priyadi commented 10 years ago

it doesn't change anything in regards with browser, it won't fix your problem. but it will send debug output to your web server error log.

ghost commented 10 years ago

After adding code that was provided by you i'ge got 500 error again

*7180 FastCGI sent in stderr: "PHP message: PHP Fatal error: Call to undefined method DOMElement::saveXML() in /hosting/mail.encryptsend.com/roundcubemail/plugins/converse/php/xmpp-prebind-php/lib/XmppPrebind.php on line 310" while reading response header from upstream, client: 88.208.1.136, server: mail.encryptsend.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "mail.encryptsend.com"

priyadi commented 10 years ago

sorry, there was a bug, I fixed it on my post above. please try again now.

ghost commented 10 years ago

Can we contact via skype or other?

ghost commented 10 years ago

Now your part of code works and i got this error, when tried to connect via converse

013/11/25 14:28:36 [error] 16158#0: *10991 FastCGI sent in stderr: "PHP message: <?xml version="1.0" encoding="UTF-8"?> " while reading response header from upstream, client: 88.208.1.136, server: mail.encryptsend.com, request:"GET /?jid=test%40chat.encryptsend.com&password= HTTP/1.1", upstream: "fastcgi://127.0.0.1:9001", host: "mail.encryptsend.com", referrer: "https://mail.encryptsend.com/?jid=test%40chat.encryptsend.com&password="

ghost commented 10 years ago

Now it shows 400 error. please tell how i can solve it.

priyadi commented 10 years ago

Hi, Sorry for leaving this for so long.

There should be two lines in your error log, one for outgoing stanza and one for incoming.

I will have intermittent internet access for this few weeks. For fast solution, if possible, can you set me up a virtual server with your Roundcube installation? With all necessary permissions for debugging. You can contact me at priyadi@priyadi.net.

borkoz commented 10 years ago

Hello, I just want to report the same issue pkutishchev : "Call to a member function getAttribute() /usr/share/roundcubemail2/plugins/roundcube-converse.js-xmpp-plugin-master/php/xmpp-prebind-php/lib/XmppPrebind.php on line 127.." One thing that I've discovered , I'm getting this error if I use non-conventional directory for my roundcube, ie /usr/share/roundcubemail2 instead of /usr/share/roundcubemai . When I changed to /usr/share/roundcubemail I didn't get php fatal error any more.

But, other things still doesn't work. I can't log in to IM server. So far I tried with ejabberd, openfire. Bosh works for me, i was able to connect through pidgin and bosh enabled. When I tried with ejabberd , it shows that I'm connected, somehow, but with red letters "disconnecting" under converse window... I can't add any other party to chat.... etc With openfire is even worst situation, it shows that I'm disconnected every time when i;m logged in to roundcube.

Regards, Borko

priyadi commented 10 years ago

@borkoz can you try renaming the plugin directory from "roundcube-converse.js-xmpp-plugin-master" to "converse"?

borkoz commented 10 years ago

@priyadi I created symbolic link converse to "roundcube-converse.js-xmpp-plugin-master". Now I moved to converse and problem remains : PHP Fatal error: Call to a member function getAttribute() on a non-object in /usr/share/roundcubemail2/plugins/converse/php/xmpp-prebind-php/lib/XmppPrebind.php on line 127, referer: http://..........

priyadi commented 10 years ago

Hi, please follow debugging instruction in TROUBLESHOOTING.md, if your converse.js at least appears, there should be some communication between browser and server.