Add the byte range request header to the request headers store in HTTPRequestHeaders_t.pBuffer.
For example, if requesting for the first 1kB of a file the following would be written: Range: bytes=0-1023\r\n\r\n
.
The trailing \r\n
that denotes the end of the header lines is overwritten, if it already exists in the buffer.
There are 3 different forms of range specification, determined by the combination of rangeStartOrLastNBytes and rangeEnd parameter values:
Range: bytes=0-1023\r\n
for requesting bytes in the range [0, 1023].rangeStartOrlastNbytes
. rangeStartOrlastNbytes
should be negative and rangeEnd
should be HTTP_RANGE_REQUEST_END_OF_FILE. Example request header line: Range: bytes=-512\r\n
for requesting the last 512 bytes (or bytes in the range [512, 1023] for a 1KB sized file).rangeStartOrlastNbytes
. rangeStartOrlastNbytes
should be >= 0 and rangeEnd
should be HTTP_RANGE_REQUEST_END_OF_FILE.Range: bytes=256-\r\n
for requesting all bytes after and including byte 256 (or bytes in the range [256,1023] for a 1kB sized file).[in] | pRequestHeaders | Request header buffer information. |
[in] | rangeStartOrlastNbytes | Represents either the starting byte for a range OR the last N number of bytes in the requested file. |
[in] | rangeEnd | The ending range for the requested file. For end of file byte in Range Specifications 2. and 3., HTTP_RANGE_REQUEST_END_OF_FILE should be passed. |
rangeStartOrlastNbytes
and rangeEnd
parameter combination is invalid. HTTPInsufficientMemory, if the passed HTTPRequestHeaders_t.pBuffer contains insufficient remaining memory for storing the range request.