private static HttpConnectionState BuildConnectionState(string url) { HttpRequest request = new HttpRequest(url); HttpResponseParser parser = new HttpResponseParser(); HttpConnectionState state = new HttpConnectionState(request, parser); return state; }
private void conn_DataReceived(TcpClientConnection<HttpConnectionState> conn, HttpConnectionState state, BufferData data) { HttpResponseParser parser = state.ResponseParser; string response = parser.Parse(data);//info:noexception if (response == null) return; conn.Close();//info:noexception TriggerCompleted(new HttpFetchResult(state.Url, response: response)); }
private void conn_Error(TcpClientConnection<HttpConnectionState> conn, HttpConnectionState state, Exception error) { TriggerCompleted(new HttpFetchResult(state.Url, error: error)); }
private void conn_Connected(TcpClientConnection<HttpConnectionState> conn, HttpConnectionState state) { HttpRequest request = state.Request; conn.SendData(request.GetBytes());//info:noexception }