public HttpConnectionWebStreamResponse(IHttpStatus httpStatus) { if (null == httpStatus) throw new ArgumentNullException(nameof(httpStatus)); _httpStatus = httpStatus; }
public HttpConnectionResponse(Uri url, IHttpConnection connection, IHttpReader reader, Stream stream, ILookup <string, string> headers, IHttpStatus status) { if ((Uri)null == url) { throw new ArgumentNullException("url"); } if (null == stream) { throw new ArgumentNullException("stream"); } if (null == headers) { throw new ArgumentNullException("headers"); } if (null == status) { throw new ArgumentNullException("status"); } this._url = url; this._reader = reader; this._stream = stream; this._headers = headers; this._status = status; this._connection = connection; }
public HttpConnectionWebStreamResponse(IHttpStatus httpStatus) { if (null == httpStatus) { throw new ArgumentNullException("httpStatus"); } this._httpStatus = httpStatus; }
public HttpConnectionWebStreamResponse(IHttpConnectionResponse response) { if (null == response) throw new ArgumentNullException(nameof(response)); if (null == response.Status) throw new ArgumentException("Not status in response", nameof(response)); _response = response; _httpStatus = _response.Status; }
public static void EnsureSuccessStatusCode(this IHttpStatus httpStatus) { if (null == httpStatus) { throw new ArgumentNullException("httpStatus"); } if (!httpStatus.IsSuccessStatusCode) { throw new StatusCodeWebException(httpStatus.StatusCode, httpStatus.ResponsePhrase, (Exception)null); } }
public HttpConnectionWebStreamResponse(IHttpConnectionResponse response) { if (null == response) { throw new ArgumentNullException("response"); } if (null == response.Status) { throw new ArgumentException("Not status in response", "response"); } this._response = response; this._httpStatus = this._response.Status; }
internal virtual async Task <IHttpConnectionResponse> GetAsync(HttpConnectionRequest request, CancellationToken cancellationToken) { IHttpConnection connection = this._httpConnectionFactory.CreateHttpConnection(); Uri requestUrl = request.Url; Uri url = requestUrl; int retry = 0; IHttpConnectionResponse response; string location; do { await connection.ConnectAsync(request.Proxy ?? url, cancellationToken).ConfigureAwait(false); request.Url = url; response = await connection.GetAsync(request, true, cancellationToken).ConfigureAwait(false); request.Url = requestUrl; IHttpStatus status = response.Status; if (HttpStatusCode.Moved == status.StatusCode || HttpStatusCode.Found == status.StatusCode) { if (++retry < 8) { connection.Close(); location = Enumerable.FirstOrDefault <string>(response.Headers["Location"]); } else { goto label_5; } } else { goto label_3; } }while (Uri.TryCreate(request.Url, location, out url)); goto label_7; label_3: IHttpConnectionResponse connectionResponse = response; goto label_9; label_5: connectionResponse = response; goto label_9; label_7: connectionResponse = response; label_9: return(connectionResponse); }
public HttpConnectionResponse(Uri url, IHttpConnection connection, IHttpReader reader, Stream stream, ILookup<string, string> headers, IHttpStatus status) { if (null == url) throw new ArgumentNullException(nameof(url)); if (null == stream) throw new ArgumentNullException(nameof(stream)); if (null == headers) throw new ArgumentNullException(nameof(headers)); if (null == status) throw new ArgumentNullException(nameof(status)); ResponseUri = url; _reader = reader; ContentReadStream = stream; Headers = headers; Status = status; _connection = connection; }