Giter Club home page Giter Club logo

simplehttp2server's Introduction

simplehttp2server serves the current directory on an HTTP/2.0 capable server. This server is for development purposes only.

Download

Binaries

simplehttp2server is go get-able:

$ go get github.com/GoogleChrome/simplehttp2server

Precompiled binaries can be found in the release section.

Brew

You can also install simplehttp2server using brew if you are on macOS:

$ brew tap GoogleChrome/simplehttp2server https://github.com/GoogleChrome/simplehttp2server
$ brew install simplehttp2server

Docker

If you have Docker set up, you can serve the current directory via simplehttp2server using the following command:

$ docker run -p 5000:5000 -v $PWD:/data surma/simplehttp2server

Push Manifest

simplehttp2server supports the push manifest. All requests will be looked up in a file named push.json. If there is a key for the request path, all resources under that key will be pushed.

Example push.json:

{
  "/": {
    "/css/app.css": {
      "type": "style",
      "weight": 1
    },
    // ...
  },
  "/page.html": {
    "/css/page.css": {
      "type": "style",
      "weight": 1
    },
    // ...
  }
}

Support for weight and type is not implemented yet. Pushes cannot trigger additional pushes.

TLS Certificate

Since HTTP/2 requires TLS, simplehttp2server checks if cert.pem and key.pem are present. If not, a self-signed certificate will be generated.

Delays

simplehttp2server can add artificial delays to responses to emulate processing time. The command line flags -mindelay and -maxdelay allow you to delay responses with a random delay form the interval [minDelay, maxDelay] in milliseconds.

If a request has a delay query parameter (like GET /index.html?delay=4000), that delay will take precedence.

Other features

  • Support for serving Single Page Applications (SPAs) using the -spa flag
  • Support for throttling network throughput per request using the -throttle flag

License

Apache 2.

simplehttp2server's People

Contributors

eduardor2k avatar pem-- avatar surma avatar

Watchers

 avatar  avatar

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.