Giter Site home page Giter Site logo

accept-encoding-range-test's Introduction

In fetch/747 it was suggested that browsers should send Accept-Encoding: identity along with range requests, else some servers ignore the range and return a 200. So, this is a test!

data.json contains all the URLs in HTTP archive that end in mp3 or mp4, de-duped by host. Warning: These are media files from the internet, so many will be not safe for work.

Here's the query:

SELECT ANY_VALUE(url) as url FROM `httparchive.runs.2018_02_15_requests`
WHERE REGEXP_CONTAINS (url, r'\.(mp4|mp3)$')
GROUP BY req_host

The test makes requests to those URLs with the following headers:

Range: bytes=0-
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

It makes a request without an Accept-Encoding header, then makes additional request for each of these headers:

Accept-Encoding: identity;q=1, *;q=0
Accept-Encoding: identity
Accept-Encoding: gzip, deflate, br

And records the status code & Content-Encoding header for each response, or {err: true} if the request timed out or failed.

The results are in results/out.json, but I recommend the interactive html results (depends on modern features like transform streams, so may only work in Chrome).

Note: The data is ndjson. Also, some servers may be unstable and return different results each time.

Running the test

Requires Node 10.2.1+.

# Generate results/out.json from data.json
node index.js
# Print the results for a particular URL
node test-url.js https://www.narita-airport.jp/files/bg.mp4
# Print results where the return is different depending on Accept-Encoding
node log-interesting-results.js

accept-encoding-range-test's People

Contributors

jakearchibald avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

accept-encoding-range-test's Issues

A couple of thoughts

Range: bytes=0- can be interpreted by servers as "the whole thing", so it's not surprising that they might think they can send back a 200. A more interesting test would be something like Range: bytes=20-200 (depending on the size of the response body).

Also, I very much wonder if anything would change if you send If-Range...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.