internal static void AbortRtcRequest(this HttpRequestMessage request)
        {
            RtcRequestMessage rtcRequest = request as RtcRequestMessage;

            if (rtcRequest != null)
            {
                rtcRequest.state.Abort();
            }
        }
        internal static void MarkRtcFlushComplete(this HttpRequestMessage request)
        {
            RtcRequestMessage rtcRequest = request as RtcRequestMessage;

            if (rtcRequest != null)
            {
                // We've sent all of the request headers and body (if any).
                rtcRequest.state.flushComplete.Set();
            }
        }
        internal static void SetRtcOptions(this HttpRequestMessage request, HttpWebRequest webRequest)
        {
#if !NET_4
            RtcRequestMessage rtcRequest = request as RtcRequestMessage;
            if (rtcRequest != null)
            {
                // Data to pass into the socket IOControl
                webRequest.RtcState = rtcRequest.state;

                // Enforce Rtc stability requirements.  We can't have the server responding at all
                // until the final response.  This may require a primer request be sent.
                webRequest.ServicePoint.Expect100Continue = false;
                webRequest.PreAuthenticate   = true;
                webRequest.KeepAlive         = false;
                webRequest.AllowAutoRedirect = false;
                webRequest.Pipelined         = false;
            }
#endif
        }