Ack for Fragment

Use the Ack for Fragment packet to acknowledge the client's Fragment request.

reason-code reason-description
BITS-Packet-Type: Ack
BITS-Session-Id: {guid}
BITS-Received-Content-Range: range
BITS-Reply-URL: url
Content-Length: length
BITS-Error-Code: error-code
BITS-Error-Context: error-context

Headers

reason-code

Replace reason-code with an HTTP reason code. The following table shows the typical reason codes for a response to a Fragment request. For a list of HTTP reason codes, see RFC 2616.

Reason code Description
200
OK. The request was successful.
416
Range-Not-Satisfiable. The client sent a fragment whose range is not contiguous with the previous fragment.

reason-description

Replace reason-description with the HTTP description associated with the reason code. For example, set reason-description to OK if reason-code is 200.

BITS-Packet-Type

Identifies this response packet as an Ack packet.

BITS-Received-Content-Range

Zero-based offset to the next byte the server expects the client to send. For example, if the fragment contained the range 128 212, you would set range to 213.

BITS-Session-Id

String GUID that identifies the session to the client. Replace {guid} with the session identifier that the client sent in the Fragment request packet. If you do not recognize the session identifier, set the BITS-Error-Code header to BG_E_SESSION_NOT_FOUND.

BITS-Reply-URL

Contains the URL to the reply data of an upload-reply job. Include this header in the final fragment response after the upload is complete and you receive a response from the server application, if applicable.

Use the Content-Range header from the Fragment request to determine whether the upload is complete. The upload is complete if the end offset of the range value equals the total-length value minus one.

The BITS server posts the upload file to the server application after it determines the upload is complete. The server application processes the file and generates the reply. The BITS server sets the value of BITS-Reply-URL to the URL of the reply file from the server application.

Content-Length

Replace length with the number of bytes included in the body of the response. Content-Length is required, even if the body of the response does not include content.

BITS-Error-Code

Replace error-code with a hexadecimal number that represents an HRESULT value associated with a server-side error. Only include this header if reason-code is not 200 or 201.

BITS-Error-Context

Replace error-context with a hexadecimal number that represents the context in which the error occurred. Specify the hexadecimal number for BG_ERROR_CONTEXT_REMOTE_FILE (0x5) if the server generated the error. Otherwise, specify the hexadecimal number for BG_ERROR_CONTEXT_REMOTE_APPLICATION (0x7) if the error was generated by the application to which the upload file is passed. Include this header only if the reason-code is not 200 or 201.

Remarks

If the session is for an upload-reply job, there may be a delay before the client receives the final Ack for Fragment response. The length of the delay depends on the amount of time the server application (application to which the server posts the upload file) takes to generate the reply.

See also

Create-Session

Fragment