about summary refs log tree commit
path: root/lib/metropolis/constants.rb
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2011-01-17 03:17:28 +0000
committerEric Wong <normalperson@yhbt.net>2011-01-17 09:18:31 +0000
commit2c913347a6e5cc8be776b14e1a177adec0fbd5b6 (patch)
tree8d001fa557ef23c66bc56aa6c2fba943e428382e /lib/metropolis/constants.rb
parent34a18520286313a05edc9a927ac4bed95b05191c (diff)
downloadmetropolis-2c913347a6e5cc8be776b14e1a177adec0fbd5b6.tar.gz
use constants everywhere to reduce GC thrashing
This makes it easier to notice a typo, too.
Diffstat (limited to 'lib/metropolis/constants.rb')
-rw-r--r--lib/metropolis/constants.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/metropolis/constants.rb b/lib/metropolis/constants.rb
new file mode 100644
index 0000000..d0a0ffd
--- /dev/null
+++ b/lib/metropolis/constants.rb
@@ -0,0 +1,20 @@
+# -*- encoding: binary -*-
+module Metropolis::Constants
+
+  # response headers, frozen for speed since they're settable hash keys
+  Content_Length = "Content-Length".freeze
+  Content_Type = "Content-Type".freeze
+  Content_Encoding = "Content-Encoding".freeze
+  Vary = "Vary".freeze
+
+  Text_Plain = "text/plain"
+  Accept_Encoding = "Accept-Encoding"
+
+  # request headers, no need to freeze since we only read them
+  Rack_Input = "rack.input"
+  PATH_INFO = "PATH_INFO"
+  REQUEST_METHOD = "REQUEST_METHOD"
+  HTTP_ACCEPT_ENCODING = "HTTP_ACCEPT_ENCODING"
+  HTTP_CONTENT_ENCODING = "HTTP_CONTENT_ENCODING"
+  HTTP_X_TT_PDMODE = "HTTP_X_TT_PDMODE"
+end