3.5.4.3.2 Sending Application Data through a Proxy

The client sets the ProxyConnection to TRUE.

The application data, if present, MUST be included within a Polling-POST-Request.

The client MUST construct the Polling-POST-Request-URI as the Polling-POST-Request-Absolute-URI, with the ServerHost as the HTTP-URL target host name.

The client MUST construct a Polling-POST-Request with required headers, as specified in section 2.2.4.1.

The client MUST construct the Polling-Virtual-Connection-Message as specified in section 2.2.4.1.3.1. This message is embedded within the Polling-Request-Entity-Body

The client MUST construct the Polling-Virtual-Connection-Message with the ServerHost as Relay-Server-Name, and VirtualConnectionGUID state variable as Virtual-Connection-GUID.

The first Polling-POST-Request after the Polling handshake MUST have a Sequence-Number of 1. Sequence-Number values MUST increase by 1 for each Polling-POST-Request sent. The last SequenceNumber sent SHOULD be stored in the RequestSequenceNum state variable and be incremented by 1 on every Polling-POST-Response sent.

The Polling-Virtual-Connection-Message Checksum field value MUST be calculated over the application data of each Polling-POST-Request message sent, as specified in section 2.2.4.1.3.1.2.

The application data, if present, is appended after the Polling-Virtual-Connection-Message; together they comprise the Polling-POST-Request-Entity-Body.

The client MUST construct a Polling-Content-Length header that is equal to the length of the Polling-Virtual-Connection-Message plus the length of the application data chunk. This content length MUST NOT exceed the 32768 octet limit imposed by the Polling protocol. If the content length would exceed the 32768 size limit, the Polling-Response-Entity-Body MUST be broken into 32768 chunks.

The NetworkReceiveIO timer SHOULD be restarted.

If ProxyAuthRequired is set, the client MUST add additional proxy authentication headers to the request.

The client MUST establish a TCP connection to the server identified with ProxyServerHostName and ProxyServerPort, and send the Polling-POST-Request.

If there is no application data, the Polling timer MUST be started with the current polling interval.