From 458ac001132a810d83c24baefdf3337bf278d567 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sun, 8 Nov 2015 21:29:13 +0900 Subject: readme: update --- README.md | 75 +++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index b95ce07..4b3c306 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ -# Plum [![Build Status](https://travis-ci.org/rhenium/plum.png?branch=master)](https://travis-ci.org/rhenium/plum) [![Code Climate](https://codeclimate.com/github/rhenium/plum/badges/gpa.svg)](https://codeclimate.com/github/rhenium/plum) [![Test Coverage](https://codeclimate.com/github/rhenium/plum/badges/coverage.svg)](https://codeclimate.com/github/rhenium/plum/coverage) -A pure Ruby HTTP/2 implementation. +# Plum: An HTTP/2 Library for Ruby +A pure Ruby HTTP/2 server and client implementation. + +WARNING: Plum is currently under heavy development. You *will* encounter bugs when using it. + +[![Build Status](https://travis-ci.org/rhenium/plum.png?branch=master)](https://travis-ci.org/rhenium/plum) [![Code Climate](https://codeclimate.com/github/rhenium/plum/badges/gpa.svg)](https://codeclimate.com/github/rhenium/plum) [![Test Coverage](https://codeclimate.com/github/rhenium/plum/badges/coverage.svg)](https://codeclimate.com/github/rhenium/plum/coverage) ## Requirements * Ruby @@ -10,7 +14,40 @@ A pure Ruby HTTP/2 implementation. * [http_parser.rb gem](https://rubygems.org/gems/http_parser.rb) (HTTP/1.x parser; if you use "http" URI scheme) * [rack gem](https://rubygems.org/gems/rack) (if you use Plum as Rack server) +## Installation +```sh +gem install plum +``` + ## Usage +* Documentation: http://www.rubydoc.info/gems/plum +* Some examples are in `examples/` + +### As a Rack-compatible server + +Most existing Rack-based applications should work without modification. + +```ruby +# config.ru +App = -> env { + [ + 200, + { "Content-Type" => "text/plain" }, + [" request: #{env["REQUEST_METHOD"]} #{env["PATH_INFO"]}"] + ] +} + +run App +``` + +You can run it: + +```sh +% plum -e production -p 8080 --https --cert server.crt --key server.key config.ru +``` + +NOTE: If `--cert` and `--key` are omitted, a temporary dummy certificate will be generated. + ### As a HTTP/2 (HTTP/1.x) client library If the server does't support HTTP/2, `Plum::Client` tries to use HTTP/1.x instead. @@ -50,41 +87,13 @@ Plum::Client.start("http2.rhe.jp", hostname: "assets.rhe.jp") { |client| } ``` -### As a Rack-compatible server - -Most existing Rack-based applications should work without modification. - -```ruby -# config.ru -App = -> env { - [ - 200, - { "Content-Type" => "text/plain" }, - [" request: #{env["REQUEST_METHOD"]} #{env["PATH_INFO"]}"] - ] -} - -run App -``` - -You can run it: - -```sh -% plum -e production -p 8080 --https config.ru -``` - -By default, Plum generates a dummy server certificate if `--cert` and `--key` options are not specified. - -### As a library -* See documentation: http://www.rubydoc.info/gems/plum -* See examples in `examples/` -* [rhenium/plum-server](https://github.com/rhenium/plum-server) - A static-file server for https://rhe.jp and http://rhe.jp. - ## TODO * **Better API** * Plum::Client - * Stream Priority support * PING frame handling + * Server Push support + * Stream Priority support + * Better HTTP/1.x support ## License MIT License -- cgit v1.2.3