Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-19566

[GSS](7.2.z) UNDERTOW-1717 - Return 416 Range Not Satisfiable when first-byte-pos of Range request header is equal to the content-length

XMLWordPrintable

    • +
    • Hide

      In EAP 7/WildFly:

      1. Create a static content that has a content size of 10.

      $ echo 0123456789 > $JBOSS_HOME/welcome-content/test.txt
      

      2. Execute the following curl command to send a request having "Range: bytes=10-" header that a first-byte-pos is equal to the content-length.

      $ curl -v -r 10- http://localhost:8080/test.txt
      

      "416 Range Not Satisfiable" should be returned, but the following"206 Partial Content" with the "Content-Length: 0" is returned by EAP 7/WildFly (Undertow).

      $ curl -v -r 10- localhost:8080/test.txt
      ...
      > GET /test.txt HTTP/1.1
      > Range: bytes=10-
      > User-Agent: curl/7.29.0
      > Host: localhost:8080
      > Accept: */*
      > 
      < HTTP/1.1 206 Partial Content
      < Connection: keep-alive
      < Last-Modified: Wed, 27 May 2020 00:54:54 GMT
      < Content-Range: bytes 10-9/10
      < Content-Length: 0
      < Content-Type: text/plain
      < Accept-Ranges: bytes
      < Date: Wed, 27 May 2020 00:56:10 GMT
      <
      
      Show
      In EAP 7/WildFly: 1. Create a static content that has a content size of 10. $ echo 0123456789 > $JBOSS_HOME/welcome-content/test.txt 2. Execute the following curl command to send a request having "Range: bytes=10-" header that a first-byte-pos is equal to the content-length. $ curl -v -r 10- http: //localhost:8080/test.txt — "416 Range Not Satisfiable" should be returned, but the following"206 Partial Content" with the "Content-Length: 0" is returned by EAP 7/WildFly (Undertow). $ curl -v -r 10- localhost:8080/test.txt ... > GET /test.txt HTTP/1.1 > Range: bytes=10- > User-Agent: curl/7.29.0 > Host: localhost:8080 > Accept: */* > < HTTP/1.1 206 Partial Content < Connection: keep-alive < Last-Modified: Wed, 27 May 2020 00:54:54 GMT < Content-Range: bytes 10-9/10 < Content-Length: 0 < Content-Type: text/plain < Accept-Ranges: bytes < Date: Wed, 27 May 2020 00:56:10 GMT <

      Undertow currently returns "206 Partial Content" with the "Content-Length: 0" when first-byte-pos of the Range request header is equal to the size of the content.

      However, RFC 7233 (https://tools.ietf.org/html/rfc7233#section-2.1) states:

      2.1. Byte Ranges
      ...(snip)...

      If a valid byte-range-set includes at least one byte-range-spec with a first-byte-pos that is less than the current length of the representation,
      or at least one suffix-byte-range-spec with a non-zero suffix-length, then the byte-range-set is satisfiable.
      Otherwise, the byte-range-set is unsatisfiable.

      So, "416 Range Not Satisfiable" should be returned in this case.

      As a side note, if you use older Undertow than the version that contains the fix for UNDERTOW-1595, the same NullPointerException as UNDERTOW-1595 happens in this case, too.

              parsharm Parul Sharma
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: