# Table of contents:
# Introduction
The HTTP Gateway is a method of accessing Notification Servers and Switchboard servers over HTTP. It was introduced with MSNP5 in Client Version 3.0.0283.
It's default HTTP URL is http://gateway.messenger.hotmail.com/gateway/gateway.dll.
# X-MSN headers
The X-MSN-Messenger header contains two values, and one optional value, and is sent on every response:
SessionID: The current Gateway Session ID. Formatted as two integers. The first integer is randomly generated and then constant for the session, and the second integer is randomized per request.GW-IP: The HTTP server to use when continuing this Gateway session. If using HTTPS, this also contains:443.Session(optional): If specified and is set toclose, then the session is to be closed.
The X-MSN-Auth header sets the current token specification method for when using
USR WEB, sent on requests only:
Use-Cookie: Use theRPSTAuth(RPS) orMSPAuthandMSPProf(PPM) cookies.Use-X-MSN-SslAuthToken: Use the contents of theX-MSN-SslAuthTokenheader.
The X-MSN-SslAuthToken header sets the current authentication token.
It contains a Passport Compact Token. Sent on requests only.
The X-MSN-Host header is the hostname to use when continuing this Gateway session.
This replaces the use of GW-IP for some clients. Sent on every response.
The X-MSN-GWCapabilities header specifies what capabilities to use, sent in both requests and responses:
*: Check available capabilities.LP: Long polling.
The X-MSN-SessionTimeout header specifies the amount of time in seconds before timing out the session. Sent on every response.
# Opening a session
NOTE: A switchboard session uses SB for the Server parameter, and the
XFR SB or a RNG's address for the IP parameter.
# Client/Request
POST /gateway/gateway.dll?Action=open&Server=NS&IP=messenger.hotmail.com HTTP/1.1
User-Agent: MSMSGS
Host: gateway.messenger.hotmail.com
Connection: Keep-Alive
Cache-Control: no-cache
Content-Type: application/x-msn-messenger
Content-Length: 13
VER 1 MSNP5
# Server/Response
HTTP/1.1 200 OK
X-MSN-Messenger: SessionID=123456789.12345; GW-IP=10.0.2.1
Content-Type: application/x-msn-messenger
Content-Length: 13
VER 1 MSNP5
# Sending a command
# Client/Request
POST /gateway/gateway.dll?SessionID=123456789.12345 HTTP/1.1
User-Agent: MSMSGS
Host: 10.0.2.1
Connection: Keep-Alive
Cache-Control: no-cache
Content-Type: application/x-msn-messenger
Content-Length: 33
USR 2 MD5 I example@hotmail.com
# Server/Response
HTTP/1.1 200 OK
X-MSN-Messenger: SessionID=123456789.6789; GW-IP=10.0.2.1
Content-Type: application/x-msn-messenger
Content-Length: 20
USR 2 MD5 S prefix
# Polling for messages
# Client/Request
POST /gateway/gateway.dll?Action=poll&SessionID=123456789.6789 HTTP/1.1
User-Agent: MSMSGS
Host: 10.0.2.1
Connection: Keep-Alive
Cache-Control: no-cache
Content-Type: application/x-msn-messenger
Content-Length: 0
# Server/Response
HTTP/1.1 200 OK
X-MSN-Messenger: SessionID=123456789.11111; GW-IP=10.0.2.1
Content-Type: application/x-msn-messenger
Content-Length: 48
NLN NLN anotheruser@hotmail.com another%20user