コード例 #1
0
 private static HttpConnectionState BuildConnectionState(string url)
 {
     HttpRequest request = new HttpRequest(url);
     HttpResponseParser parser = new HttpResponseParser();
     HttpConnectionState state = new HttpConnectionState(request, parser);
     return state;
 }
コード例 #2
0
 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));
 }
コード例 #3
0
 private void conn_Error(TcpClientConnection<HttpConnectionState> conn, HttpConnectionState state, Exception error)
 {
     TriggerCompleted(new HttpFetchResult(state.Url, error: error));
 }
コード例 #4
0
 private void conn_Connected(TcpClientConnection<HttpConnectionState> conn, HttpConnectionState state)
 {
     HttpRequest request = state.Request;
     conn.SendData(request.GetBytes());//info:noexception
 }