Table of Contents

Class HttpUtils

Namespace
VpnHood.Core.Tunneling.Utils
Assembly
VpnHood.Core.Tunneling.dll

Provides the reading of an HTTP response's header off a stream, as a client reads its server's.

public static class HttpUtils
Inheritance
HttpUtils
Inherited Members

Methods

ReadResponse(Stream, CancellationToken, int)

Reads an HTTP response's header off a stream: its status and headers, with no body.

public static Task<HttpResponseMessage> ReadResponse(Stream stream, CancellationToken cancellationToken, int maxLength = 131072)

Parameters

stream Stream

The stream.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

maxLength int

The longest header it takes, in bytes. The default is 128 KB.

Returns

Task<HttpResponseMessage>

A task whose result is the response.

Exceptions

Exception

The stream ended, before the header or inside it; the header is longer than allowed; or it is not an HTTP response's.

FormatException

The status code is not a number.

OverflowException

The status code is out of an integer's range.

OperationCanceledException

cancellationToken was canceled.