diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-08-02 15:30:55 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-08-09 01:28:26 -0700 |
commit | 6dfc7482e4414a7b2d18af127065c15aede39b62 (patch) | |
tree | f36b4ec27877dd23d84704e4b58109fdd773fc17 /ext | |
parent | 0d89349e78092ad65dfca5b9131218cef0476a37 (diff) | |
download | unicorn-6dfc7482e4414a7b2d18af127065c15aede39b62.tar.gz |
http: cleanup setting for common values => globals
We'll need to be defining g_http_transfer_encoding and g_content_length in the near future.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/unicorn_http/unicorn_http.rl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl index 299d2d9..6ce6be4 100644 --- a/ext/unicorn_http/unicorn_http.rl +++ b/ext/unicorn_http/unicorn_http.rl @@ -310,6 +310,11 @@ static VALUE HttpParser_execute(VALUE self, VALUE req, VALUE data) rb_raise(eHttpParserError, "Requested start is after data buffer end."); } +#define SET_GLOBAL(var,str) do { \ + var = find_common_field(str, sizeof(str) - 1); \ + assert(var != Qnil); \ +} while (0) + void Init_unicorn_http(void) { init_globals(); @@ -318,6 +323,6 @@ void Init_unicorn_http(void) rb_define_method(cHttpParser, "reset", HttpParser_reset,0); rb_define_method(cHttpParser, "execute", HttpParser_execute,2); init_common_fields(); - g_http_host = find_common_field("HOST", 4); - assert(g_http_host != Qnil); + SET_GLOBAL(g_http_host, "HOST"); } +#undef SET_GLOBAL |