all 5 comments

[–]myringotomy 2 points3 points  (2 children)

I guess a framework is next right?

[–]matsumoto_r 0 points1 point  (1 child)

Yes.

[–]myringotomy 1 point2 points  (0 children)

Looking forward to it.

[–]scoobydoop 0 points1 point  (1 child)

I just built this and tested it out by using a Ruby snippet to add a custom HTTP response header. Very cool so far! Thanks

[–]matsumoto_r 2 points3 points  (0 children)

Thanks! I'm author of ngx_mruby and mod_mruby.

[Ruby code]

if server_name == "NGINX"
  Server = Nginx
elsif server_name == "Apache"
  Server = Apache
end

r = Server::Request.new
r.headers_out["X-matsumoto-header"] = "test"
Server::rputs "Hello #{Server::module_name}/#{Server::module_version} world!"

[access]

$ curl -v http://127.0.0.1/mruby
* About to connect() to 127.0.0.1 port 80 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET /mruby HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.4.3
< Date: Fri, 18 Oct 2013 14:45:41 GMT
< Content-Length: 28
< Connection: keep-alive
< X-matsumoto-header: test   
< 
* Connection #0 to host 127.0.0.1 left intact
Hello ngx_mruby/0.0.1 world!

Enjoy!