Dell DX6004S DX Object Storage Application Guide - Page 18

Handling Redirects, 6. Using Range Headers

Page 18 highlights

Most of these client libraries will take care of the low-level protocol issues for you. Formatting the requests and interpreting the responses are usually much easier with an existing framework. In fact, much of the SCSP discussion above can be skipped, allowing the framework to do the work for you. 3.5. Handling Redirects Some HTTP client libraries and frameworks do not handle redirects correctly for WRITE requests, at least not by default. Older versions of the HTTP protocol, namely HTTP/1.0, were lax in their specification of exactly what the client must do when it receives a 301 or a 307 response code. Because of this, older clients, including many web browsers, developed their own conventions. While some of these conventions might be useful, they are in direct violation of the HTTP/1.1 specification and therefore incompatible with DX Storage. Both the Microsoft .NET framework and the libCURL framework (and probably others) are known to process a redirect from a POST request by changing the POST to a GET and then sending the new request to the redirect server. Workarounds exist in the impacted frameworks because the behavior is known to be in violation of the specification. To quote RFC 2616: "When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request." 3.6. Using Range Headers In some cases, an application might be interested in only a byte portion of a larger object stored in DX Storage. Rather than read the entire object and filter out the interesting parts, the application can include one or more Range headers with an SCSP READ request. A READ request can include more than one Range header. Consult the HTTP/1.1 specification for a thorough discussion of Range headers. Here are some examples and their interpretations: Range: 0-499 Return the first 500 bytes of the object Range: 500-999 Return the second 500 bytes Range: -500 Return the last 500 bytes Range: 0-499, 500-999 Return the first 1000 bytes Note Range headers are not compatible with integrity seals because an integrity seal is a hash of the object's entire contents. If the Range is not set to a value greater than or equal to the size of the object, the connection is closed as if the integrity seal was invalid. For more information about integrity seals, see Section 20.1, "Integrity Seals". READ requests that include invalid Range headers (for example, ranges that do not exist in the object) cause DX Storage to respond with a 416 Range not satisfiable error. A successful response to a READ that includes one or more Range headers is 206 Partial content. Of course, only data in the requested ranges are included in the 206 response. READ requests that include a range like Range: 0-199, 300-349, 500-999 returns a Content-Type: multipart/byteranges response consisting of three parts: 200, 50, and 500 bytes of content. For more information, see section 14.35 (Range) and appendix 19.2 (Internet Media Type multipart/ byteranges) in the HTTP/1.1 RFC. Copyright © 2010 Caringo, Inc. All rights reserved 13 Version 5.0 December 2010

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81

Copyright © 2010 Caringo, Inc.
All rights reserved
13
Version 5.0
December 2010
Most of these client libraries will take care of the low-level protocol issues for you. Formatting the
requests and interpreting the responses are usually much easier with an existing framework. In fact,
much of the SCSP discussion above can be skipped, allowing the framework to do the work for you.
3.5. Handling Redirects
Some HTTP client libraries and frameworks do not handle redirects correctly for WRITE requests,
at least not by default. Older versions of the HTTP protocol, namely HTTP/1.0, were lax in their
specification of exactly what the client must do when it receives a 301 or a 307 response code.
Because of this, older clients, including many web browsers, developed their own conventions.
While some of these conventions might be useful, they are in direct violation of the HTTP/1.1
specification and therefore incompatible with DX Storage.
Both the Microsoft .NET framework and the libCURL framework (and probably others) are known to
process a redirect from a POST request by changing the POST to a GET and then sending the new
request to the redirect server. Workarounds exist in the impacted frameworks because the behavior
is known to be in violation of the specification. To quote
RFC 2616
:
"When automatically redirecting a POST request after receiving a 301 status code, some existing
HTTP/1.0 user agents will erroneously change it into a GET request."
3.6. Using Range Headers
In some cases, an application might be interested in only a byte portion of a larger object stored in
DX Storage. Rather than read the entire object and filter out the interesting parts, the application
can include one or more
Range headers
with an SCSP READ request. A READ request can include
more than one Range header. Consult the
HTTP/1.1 specification
for a thorough discussion of
Range headers. Here are some examples and their interpretations:
Range: 0-499
Return the first 500 bytes of the object
Range: 500-999
Return the second 500 bytes
Range: -500
Return the last 500 bytes
Range: 0-499, 500-999
Return the first 1000 bytes
Note
Range headers are not compatible with integrity seals because an integrity seal is a hash
of the object's entire contents. If the Range is not set to a value greater than or equal
to the size of the object, the connection is closed as if the integrity seal was invalid. For
more information about integrity seals, see
Section 20.1, “Integrity Seals”
.
READ requests that include invalid Range headers (for example, ranges that do not exist in the
object) cause DX Storage to respond with a
416 Range not satisfiable
error. A successful response
to a READ that includes one or more Range headers is
206 Partial content
. Of course, only data in
the requested ranges are included in the 206 response.
READ requests that include a range like
Range: 0-199, 300-349, 500-999
returns a
Content-Type: multipart/byteranges
response consisting of three parts: 200, 50, and 500
bytes of content.
For more information, see
section 14.35 (Range)
and
appendix 19.2 (Internet Media Type multipart/
byteranges)
in the
HTTP/1.1 RFC
.