IBackgroundCopyJobHttpOptions2::SetHttpMethod method (bits10_2.h)

Overrides the default HTTP method used for a BITS transfer.

Syntax

HRESULT SetHttpMethod(
  [in] LPCWSTR method
);

Parameters

[in] method

Type: LPCWSTR

A pointer to a constant null-terminated string of wide characters containing the HTTP method name.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

BITS allows you, as the developer, to choose an HTTP method other than the default method. This increases BITS' ability to interact with servers that don't adhere to the normal BITS requirements for HTTP servers. Bear the following in mind when you choose a different HTTP method from the default one.

  • BITS automatically changes the job priority to BG_JOB_PRIORITY_FOREGROUND, and prevents that priority from being changed.
  • An error that would ordinarily be resumable (such as loss of connectivity) transitions the job to an ERROR state. You, as the developer, can restart the job by calling IBackgroundCopyJob::Resume, and the job will be restarted from the beginning. See Life Cycle of a BITS Job for more information on BITS job states.
  • BITS doesn’t allow DYNAMIC_CONTENT nor ON_DEMAND_MODE jobs with SetHttpMethod.
SetHttpMethod does nothing if the method name that you pass matches the default HTTP method for the transfer type. For example, if you set a download job method to "GET" (the default), then the job priority won't be changed. The HTTP method must be set before the first call to IBackgroundCopyJob::Resume that starts the job.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1809 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header bits10_2.h (include Bits.h)
Library Bits.lib

See also

IBackgroundCopyJobHttpOptions2