Table of Contents

Class HttpRequest

Namespace
Amazon.Runtime.Internal
Assembly
AWSSDK.Core.dll

HTTP request wrapper for System.Net.HttpWebRequest.

public class HttpRequest : IHttpRequest<Stream>, IDisposable
Inheritance
HttpRequest
Implements
Inherited Members

Constructors

HttpRequest(Uri)

Constructor for HttpRequest.

public HttpRequest(Uri requestUri)

Parameters

requestUri Uri

The request URI.

Properties

Method

The HTTP method or verb.

public string Method { get; set; }

Property Value

string

Request

The underlying HTTP web request.

public HttpWebRequest Request { get; }

Property Value

HttpWebRequest

RequestUri

The request URI.

public Uri RequestUri { get; }

Property Value

Uri

Methods

Abort()

Aborts the HTTP request.

public void Abort()

BeginGetRequestContent(AsyncCallback, object)

Initiates the operation to gets a handle to the request content.

public IAsyncResult BeginGetRequestContent(AsyncCallback callback, object state)

Parameters

callback AsyncCallback

The async callback invoked when the operation completes.

state object

The state object to be passed to the async callback.

Returns

IAsyncResult

IAsyncResult that represents an async operation.

BeginGetResponse(AsyncCallback, object)

Initiates the operation to Returns the HTTP response.

public IAsyncResult BeginGetResponse(AsyncCallback callback, object state)

Parameters

callback AsyncCallback

The async callback invoked when the operation completes.

state object

The state object to be passed to the async callback.

Returns

IAsyncResult

IAsyncResult that represents an async operation.

ConfigureRequest(IRequestContext)

Configures a request as per the request context.

public virtual void ConfigureRequest(IRequestContext requestContext)

Parameters

requestContext IRequestContext

The request context.

Dispose()

Disposes the HttpRequest.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

EndGetRequestContent(IAsyncResult)

Ends the operation to gets a handle to the request content.

public Stream EndGetRequestContent(IAsyncResult asyncResult)

Parameters

asyncResult IAsyncResult

IAsyncResult that represents an async operation.

Returns

Stream

The request content.

EndGetResponse(IAsyncResult)

Ends the operation to Returns the HTTP response.

public virtual IWebResponseData EndGetResponse(IAsyncResult asyncResult)

Parameters

asyncResult IAsyncResult

IAsyncResult that represents an async operation.

Returns

IWebResponseData

The HTTP response.

GetRequestContent()

Gets a handle to the request content.

public Stream GetRequestContent()

Returns

Stream

The request content.

GetResponse()

Returns the HTTP response.

public virtual IWebResponseData GetResponse()

Returns

IWebResponseData

The HTTP response.

SetRequestHeaders(IDictionary<string, string>)

Sets the headers on the request.

public void SetRequestHeaders(IDictionary<string, string> headers)

Parameters

headers IDictionary<string, string>

A dictionary of header names and values.

SetupProgressListeners(Stream, long, object, EventHandler<StreamTransferProgressArgs>)

Sets up the progress listeners

public Stream SetupProgressListeners(Stream originalStream, long progressUpdateInterval, object sender, EventHandler<StreamTransferProgressArgs> callback)

Parameters

originalStream Stream

The content stream

progressUpdateInterval long

The interval at which progress needs to be published

sender object

The objects which is trigerring the progress changes

callback EventHandler<StreamTransferProgressArgs>

The callback which will be invoked when the progress changed event is trigerred

Returns

Stream

an EventStream object, incase the progress is setup, else returns the original stream

WriteToRequestBody(Stream, byte[], IDictionary<string, string>)

Writes a byte array to the request body.

public void WriteToRequestBody(Stream requestContent, byte[] content, IDictionary<string, string> contentHeaders)

Parameters

requestContent Stream

The destination where the content stream is written.

content byte[]

The content stream to be written.

contentHeaders IDictionary<string, string>

HTTP content headers.

WriteToRequestBody(Stream, Stream, IDictionary<string, string>, IRequestContext)

Writes a stream to the request body.

public void WriteToRequestBody(Stream requestContent, Stream contentStream, IDictionary<string, string> contentHeaders, IRequestContext requestContext)

Parameters

requestContent Stream

The destination where the content stream is written.

contentStream Stream

The content stream to be written.

contentHeaders IDictionary<string, string>

HTTP content headers.

requestContext IRequestContext

The request context.