Last active
September 17, 2015 15:14
-
-
Save kysnm/0487ec768d9f971abc08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git submodule add [email protected]:kentaro/mruby-hibari.git deps/mruby-hibari | |
$ cmake -DWITH_MRUBY=ON . && make | |
$ ./h2o --version && ./h2o -c examples/h2o_mruby/h2o.conf | |
h2o version 1.5.0-beta2 | |
OpenSSL: OpenSSL 1.0.2d 9 Jul 2015 | |
mruby: YES | |
[INFO] raised RLIMIT_NOFILE to 10240 | |
fetch-ocsp-response (using OpenSSL 1.0.2d 9 Jul 2015) | |
fetch-ocsp-response (using OpenSSL 1.0.2d 9 Jul 2015) | |
h2o server (pid:60181) is ready to serve requests | |
failed to extract ocsp URI from examples/h2o/server.crt | |
[OCSP Stapling] disabled for certificate file:examples/h2o/server.crt | |
failed to extract ocsp URI from examples/h2o/server.crt | |
[OCSP Stapling] disabled for certificate file:examples/h2o/server.crt | |
fetch-ocsp-response (using OpenSSL 1.0.2d 9 Jul 2015) | |
fetch-ocsp-response (using OpenSSL 1.0.2d 9 Jul 2015) | |
failed to extract ocsp URI from examples/h2o/alternate.crt | |
[OCSP Stapling] disabled for certificate file:examples/h2o/alternate.crt | |
failed to extract ocsp URI from examples/h2o/alternate.crt | |
[OCSP Stapling] disabled for certificate file:examples/h2o/alternate.crt | |
::1 - - [18/Sep/2015:00:08:32 +0900] "GET /?hoge=fuga HTTP/1.1" 200 23 "-" "curl/7.30.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl http://localhost:8080/?hoge=fuga | |
Hello, World!hoge: fuga |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.gitmodules b/.gitmodules | |
index bcf281d..c9c5ffa 100644 | |
--- a/.gitmodules | |
+++ b/.gitmodules | |
@@ -7,3 +7,6 @@ | |
[submodule "misc/oktavia"] | |
path = misc/oktavia | |
url = https://github.com/shibukawa/oktavia.git | |
+[submodule "deps/mruby-hibari"] | |
+ path = deps/mruby-hibari | |
+ url = [email protected]:kentaro/mruby-hibari.git | |
diff --git a/examples/h2o_mruby/h2o.conf b/examples/h2o_mruby/h2o.conf | |
index cf94ec3..982c185 100644 | |
--- a/examples/h2o_mruby/h2o.conf | |
+++ b/examples/h2o_mruby/h2o.conf | |
@@ -10,8 +10,7 @@ hosts: | |
"127.0.0.1.xip.io:8080": | |
paths: | |
/: | |
- file.dir: examples/doc_root | |
- mruby.handler-file: examples/h2o_mruby/hello.rb | |
+ mruby.handler-file: examples/h2o_mruby/hibari.rb | |
access-log: /dev/stdout | |
"alternate.127.0.0.1.xip.io:8081": | |
listen: | |
diff --git a/examples/h2o_mruby/hibari.rb b/examples/h2o_mruby/hibari.rb | |
new file mode 100644 | |
index 0000000..d025b49 | |
--- /dev/null | |
+++ b/examples/h2o_mruby/hibari.rb | |
@@ -0,0 +1,12 @@ | |
+class MyApp < Hibari::App | |
+ def build | |
+ res.code = 200 | |
+ res.headers["content-type"] = "text/html; charset=utf8" | |
+ res.body.push("Hello, World!") | |
+ req.params.each do |k,v| | |
+ res.body.push("#{k}: #{v}") | |
+ end | |
+ end | |
+end | |
+ | |
+MyApp.new.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment