summaryrefslogtreecommitdiffstats
path: root/debian/vendor-h2o/examples/h2o_mruby
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:12:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:12:02 +0000
commit77e50caaf2ef81cd91075cf836fed0e75718ffb4 (patch)
tree53b7b411290b63192fc9e924a3b6b65cdf67e9d0 /debian/vendor-h2o/examples/h2o_mruby
parentAdding upstream version 1.8.3. (diff)
downloaddnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.tar.xz
dnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.zip
Adding debian version 1.8.3-2.debian/1.8.3-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/vendor-h2o/examples/h2o_mruby')
-rw-r--r--debian/vendor-h2o/examples/h2o_mruby/h2o.conf25
-rw-r--r--debian/vendor-h2o/examples/h2o_mruby/hello.rb32
2 files changed, 57 insertions, 0 deletions
diff --git a/debian/vendor-h2o/examples/h2o_mruby/h2o.conf b/debian/vendor-h2o/examples/h2o_mruby/h2o.conf
new file mode 100644
index 0000000..cf94ec3
--- /dev/null
+++ b/debian/vendor-h2o/examples/h2o_mruby/h2o.conf
@@ -0,0 +1,25 @@
+# to find out the configuration commands, run: h2o --help
+
+listen: 8080
+listen:
+ port: 8081
+ ssl:
+ certificate-file: examples/h2o/server.crt
+ key-file: examples/h2o/server.key
+hosts:
+ "127.0.0.1.xip.io:8080":
+ paths:
+ /:
+ file.dir: examples/doc_root
+ mruby.handler-file: examples/h2o_mruby/hello.rb
+ access-log: /dev/stdout
+ "alternate.127.0.0.1.xip.io:8081":
+ listen:
+ port: 8081
+ ssl:
+ certificate-file: examples/h2o/alternate.crt
+ key-file: examples/h2o/alternate.key
+ paths:
+ /:
+ file.dir: examples/doc_root.alternate
+ access-log: /dev/stdout
diff --git a/debian/vendor-h2o/examples/h2o_mruby/hello.rb b/debian/vendor-h2o/examples/h2o_mruby/hello.rb
new file mode 100644
index 0000000..bceb7b0
--- /dev/null
+++ b/debian/vendor-h2o/examples/h2o_mruby/hello.rb
@@ -0,0 +1,32 @@
+# paths:
+# /:
+# file.dir: examples/doc_root
+# mruby.handler-file: /path/to/hello.rb
+
+class HelloApp
+ def call(env)
+ h = "hello"
+ m = "from h2o_mruby"
+
+ ua = env["HTTP_USER_AGENT"]
+ new_ua = "new-#{ua}-h2o_mruby"
+ path = env["PATH_INFO"]
+ host = env["HTTP_HOST"]
+ method = env["REQUEST_METHOD"]
+ query = env["QUERY_STRING"]
+ input = env["rack.input"] ? env["rack.input"].read : ""
+
+ msg = "#{h} #{m}. User-Agent:#{ua} New User-Agent:#{new_ua} path:#{path} host:#{host} method:#{method} query:#{query} input:#{input}"
+
+ [200,
+ {
+ "content-type" => "text/plain; charset=utf-8",
+ "user-agent" => new_ua,
+ },
+ ["#{msg}\n"]
+ ]
+
+ end
+end
+
+HelloApp.new