[Pidgin] #2638: "Message could not be sent because a connection error occurred:" (w/ MSN HTTP Method)

Pidgin trac at pidgin.im
Wed Sep 12 14:08:52 EDT 2007


#2638: "Message could not be sent because a connection error occurred:" (w/ MSN
HTTP Method)
---------------------------+------------------------------------------------
  Reporter:  ThorbjornTux  |       Owner:                     
      Type:  defect        |      Status:  new                
  Priority:  major         |   Milestone:  Merge MSNP14 Branch
 Component:  libpurple     |     Version:  2.1.0              
Resolution:                |    Keywords:                     
   Pending:  0             |  
---------------------------+------------------------------------------------
Comment (by laszlok):

 I think I have solved it. This works perfectly for me behind a corporate
 firewall that only allows port 80 out.
 == Here is the issue: ==
 The default value for the msn server address is messenger.hotmail.com. You
 can see this is filled in beside "Server:" in the "Advanced" tab of the
 "Modify Account" dialog. However this server is only used for non-http
 connections. To use HTTP and bypass a corporate firewall, you must use
 gateway.messenger.hotmail.com. This address is hard-coded in the
 msn_httpconn_connect() function in libpurple/protocols/msn/httpconn.c. So
 no matter what host and port are given as arguments to
 msn_httpconn_connect(), it will always connect to
 gateway.messenger.hotmail.com on port 80.

 The problem arises when the msn server tells us to use another host. This
 only recently stopped working, so I am guessing up until then microsoft
 used the same server for everything. When you want to start chatting to
 someone, the client sends a switchboard request to the server:
 {{{
 XFR 12 SB
 }}}

 Then the server responds with the information on how to connect to the
 switchboard:
 {{{
 XFR 12 SB 65.54.171.30:1863 CKI 151986110.22113252.20218652
 }}}

 You can see there is a host and port given for the switchboard in
 "65.54.171.30:1863". The other two arguments are authentication method and
 session ID. Of course this was designed before the HTTP method was in use,
 because as you know we can't connect to port 1863 because of our corporate
 firewall; we have to use port 80. However the server still expects us to
 connect to the given host on port 80. So we need to connect to
 65.54.171.30:80.

 The pidgin code parses the host and port nicely, and requests a new
 connection to that server, but these arguments are ignored because both
 the host and port are hard-coded in msn_httpconn_connect(). It tried to
 connect to the switchboard at gateway.messenger.hotmail.com, but that
 server is not a switchboard, and sends HTTP 400 Bad Request. Pidgin then
 reports this to the user as "Message could not be sent because a
 connection error occurred".

 == How to fix it: ==
 First you have to apply my patch, which removes the hard-coded
 gateway.messenger.hotmail.com, and allows it to use the one in the
 "Advanced" tab of the "Modify Account" dialog.
 It's a simple one line patch:
 {{{
 --- libpurple/protocols/msn/httpconn.c  2007-08-20 14:12:48.000000000
 -0400
 +++ libpurple-http-fixed/protocols/msn/httpconn.c       2007-09-12
 13:26:25.000000000 -0400
 @@ -725,7 +725,7 @@
                 msn_httpconn_disconnect(httpconn);

         httpconn->connect_data = purple_proxy_connect(NULL,
 httpconn->session->account,
 -               "gateway.messenger.hotmail.com", 80, connect_cb,
 httpconn);
 +               host, 80, connect_cb, httpconn);

         if (httpconn->connect_data != NULL)
         {

 }}}

  1. Apply the patch to the 2.1.1 release (I haven't tested it out with
 anything else).
  1. Make, make install.
  1. Run Pidgin, and open Account -> Add/Edit. Select you MSN account and
 click Modify.
  1. Go the the Advanced tab, and change Server to
 "gateway.messenger.hotmail.com" without the quotes.
  1. Make sure Port is 80, and "Use HTTP Method" is selected.
  1. Logout and login again. You should be able to chat now.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/2638#comment:47>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list