/// <summary>
        /// Returns a response from an Internet resource.  Overrides the 
        /// <itemref>WebRequest</itemref>.<see cref="System.Net.WebRequest.GetResponse"/> 
        /// method.
        /// </summary>
        /// <returns>The response from the Internet resource.</returns>
        public override WebResponse GetResponse()
        {
            HttpWebResponse response = null;

            try
            {
                // If response was not sent, Submit the request. 
                if (!m_requestSent)
                {
                    SubmitRequest();
                }

                CoreResponseData respData = null;

                // reset the total response bytes for the new request.
                m_requestStream.m_BytesLeftInResponse = -1;

                // create the request timeout timer.  This will kill the operation if it takes longer than specified by the Timeout property.  
                // The underlying socket will be closed to end the web request
                using (Timer tmr = new Timer(new TimerCallback(OnRequestTimeout), null, m_timeout, System.Threading.Timeout.Infinite))
                {
                    // Processes response from server. Request stream should already be there.

                    respData = ParseHTTPResponse(m_requestStream, m_keepAlive);

                    if (respData.m_statusCode == (int)HttpStatusCode.Continue)
                    {
                        if (m_continueDelegate != null)
                        {
                            m_continueDelegate(respData.m_statusCode, respData.m_headers);
                        }
                        else
                        {
                            respData = ParseHTTPResponse(m_requestStream, m_keepAlive);
                        }
                    }
                }
                
                response = new HttpWebResponse(m_method, m_originalUrl, respData, this);
                
                // Now we look if response has chunked encoding. If it is chunked, we need to set flag in m_requestStream we return.
                if (respData.m_chunked)
                {
                    m_requestStream.m_EnableChunkedDecoding = true;
                }

                // Currently the request and response are the same network streams, but we optimize later.
                response.SetResponseStream(m_requestStream);

                m_responseStatus = response.StatusCode;

                m_responseCreated = true;
            }
            catch(SocketException se)
            {
                if (m_requestStream != null)
                {
                    m_requestStream.m_InUse = false;

                    if (m_requestStream.m_Socket != null)
                    {
                        this.m_requestStream.m_Socket.Close();
                    }
                }

                throw new WebException("", se);
            }
            catch(Exception e)
            {
                throw new WebException("", e);
            }


            return response;
        }