OSDN Git Service

ActiveLdap 1.2.4
[redminele/redminele.git] / ruby / lib / ruby / gems / 1.8 / gems / mongrel-1.1.5-x86-mswin32-60 / lib / mongrel / const.rb
1
2 module Mongrel
3
4   # Every standard HTTP code mapped to the appropriate message.  These are
5   # used so frequently that they are placed directly in Mongrel for easy
6   # access rather than Mongrel::Const itself.
7   HTTP_STATUS_CODES = {  
8     100  => 'Continue', 
9     101  => 'Switching Protocols', 
10     200  => 'OK', 
11     201  => 'Created', 
12     202  => 'Accepted', 
13     203  => 'Non-Authoritative Information', 
14     204  => 'No Content', 
15     205  => 'Reset Content', 
16     206  => 'Partial Content', 
17     300  => 'Multiple Choices', 
18     301  => 'Moved Permanently', 
19     302  => 'Moved Temporarily', 
20     303  => 'See Other', 
21     304  => 'Not Modified', 
22     305  => 'Use Proxy', 
23     400  => 'Bad Request', 
24     401  => 'Unauthorized', 
25     402  => 'Payment Required', 
26     403  => 'Forbidden', 
27     404  => 'Not Found', 
28     405  => 'Method Not Allowed', 
29     406  => 'Not Acceptable', 
30     407  => 'Proxy Authentication Required', 
31     408  => 'Request Time-out', 
32     409  => 'Conflict', 
33     410  => 'Gone', 
34     411  => 'Length Required', 
35     412  => 'Precondition Failed', 
36     413  => 'Request Entity Too Large', 
37     414  => 'Request-URI Too Large', 
38     415  => 'Unsupported Media Type', 
39     500  => 'Internal Server Error', 
40     501  => 'Not Implemented', 
41     502  => 'Bad Gateway', 
42     503  => 'Service Unavailable', 
43     504  => 'Gateway Time-out', 
44     505  => 'HTTP Version not supported'
45   }
46
47   # Frequently used constants when constructing requests or responses.  Many times
48   # the constant just refers to a string with the same contents.  Using these constants
49   # gave about a 3% to 10% performance improvement over using the strings directly.
50   # Symbols did not really improve things much compared to constants.
51   #
52   # While Mongrel does try to emulate the CGI/1.2 protocol, it does not use the REMOTE_IDENT,
53   # REMOTE_USER, or REMOTE_HOST parameters since those are either a security problem or 
54   # too taxing on performance.
55   module Const
56     DATE = "Date".freeze
57
58     # This is the part of the path after the SCRIPT_NAME.  URIClassifier will determine this.
59     PATH_INFO="PATH_INFO".freeze
60
61     # This is the initial part that your handler is identified as by URIClassifier.
62     SCRIPT_NAME="SCRIPT_NAME".freeze
63
64     # The original URI requested by the client.  Passed to URIClassifier to build PATH_INFO and SCRIPT_NAME.
65     REQUEST_URI='REQUEST_URI'.freeze
66     REQUEST_PATH='REQUEST_PATH'.freeze
67
68     MONGREL_VERSION="1.1.5".freeze
69
70     MONGREL_TMP_BASE="mongrel".freeze
71
72     # The standard empty 404 response for bad requests.  Use Error4040Handler for custom stuff.
73     ERROR_404_RESPONSE="HTTP/1.1 404 Not Found\r\nConnection: close\r\nServer: Mongrel #{MONGREL_VERSION}\r\n\r\nNOT FOUND".freeze
74
75     CONTENT_LENGTH="CONTENT_LENGTH".freeze
76
77     # A common header for indicating the server is too busy.  Not used yet.
78     ERROR_503_RESPONSE="HTTP/1.1 503 Service Unavailable\r\n\r\nBUSY".freeze
79
80     # The basic max request size we'll try to read.
81     CHUNK_SIZE=(16 * 1024)
82
83     # This is the maximum header that is allowed before a client is booted.  The parser detects
84     # this, but we'd also like to do this as well.
85     MAX_HEADER=1024 * (80 + 32)
86
87     # Maximum request body size before it is moved out of memory and into a tempfile for reading.
88     MAX_BODY=MAX_HEADER
89
90     # A frozen format for this is about 15% faster
91     STATUS_FORMAT = "HTTP/1.1 %d %s\r\nConnection: close\r\n".freeze
92     CONTENT_TYPE = "Content-Type".freeze
93     LAST_MODIFIED = "Last-Modified".freeze
94     ETAG = "ETag".freeze
95     SLASH = "/".freeze
96     REQUEST_METHOD="REQUEST_METHOD".freeze
97     GET="GET".freeze
98     HEAD="HEAD".freeze
99     # ETag is based on the apache standard of hex mtime-size-inode (inode is 0 on win32)
100     ETAG_FORMAT="\"%x-%x-%x\"".freeze
101     HEADER_FORMAT="%s: %s\r\n".freeze
102     LINE_END="\r\n".freeze
103     REMOTE_ADDR="REMOTE_ADDR".freeze
104     HTTP_X_FORWARDED_FOR="HTTP_X_FORWARDED_FOR".freeze
105     HTTP_IF_MODIFIED_SINCE="HTTP_IF_MODIFIED_SINCE".freeze
106     HTTP_IF_NONE_MATCH="HTTP_IF_NONE_MATCH".freeze
107     REDIRECT = "HTTP/1.1 302 Found\r\nLocation: %s\r\nConnection: close\r\n\r\n".freeze
108     HOST = "HOST".freeze
109   end
110 end