--1PHmS26pdpOR3Xc0
Content-Type: multipart/mixed; boundary="mgIE+9cwyCTt+85Z"
Content-Disposition: inline


--mgIE+9cwyCTt+85Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Everyone,

Attached is a patch against Ruby 1.8.4 which adds missing HTTP headers,
environment variables, and HTTP status codes to CGI.rb.

Here's a complete list of additions:

HTTP Headers
============
  * If-Modified-Since
  * If-None-Match

Environment Variables
=====================
  * DOCUMENT_ROOT
  * REMOTE_PORT
  * SERVER_ADMIN
  * SERVER_ADDR
  * UNIQUE_ID
  * SCRIPT_FILENAME (note that this is different from SCRIPT_NAME)

HTTP Status Codes
=================
  * 100 Continue
  * 101 Switching Protocols
  * 201 Created
  * 202 Accepted
  * 203 Non-Authoritative Information
  * 204 No Content
  * 205 Reset Content
  * 303 See Other
  * 305 Use Proxy
  * 306 (Unused)
  * 307 Temporary Redirect
  * 402 Payment Required
  * 407 Proxy Authentication Required
  * 408 Request Timeout
  * 409 Conflict
  * 410 Gone
  * 413 Request Entity Too Large
  * 414 Request-URI Too Long
  * 415 Unsupported Media Type
  * 416 Requested Range Not Satisfiable
  * 417 Expectation Failed
  * 503 Service Unavailable
  * 504 Gateway Timeout
  * 505 HTTP Version Not Supported

The patch also updates the documentation at the top of CGI.rb to reflect
the new HTTP headers and environment variables.  On the off-chance that
your mail client mangles the attachment, it's also available at the
following URL:

 http://diff.pablotron.org/ruby-1.8.4-cgi_headers.diff 

-- 
Paul Duncan <pabs / pablotron.org>        OpenPGP Key ID: 0x82C29562
http://www.pablotron.org/               http://www.paulduncan.org/

--mgIE+9cwyCTt+85Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ruby-1.8.4-cgi_headers.diff"
Content-Transfer-Encoding: quoted-printable

Only in ruby-1.8.4/lib: .cgi.rb.swp
diff -ur ruby-1.8.4-orig/lib/cgi.rb ruby-1.8.4/lib/cgi.rb
--- ruby-1.8.4-orig/lib/cgi.rb	2005-10-06 21:01:22.000000000 -0400
+++ ruby-1.8.4/lib/cgi.rb	2005-12-15 00:47:42.000000000 -0500
@@ -64,16 +64,19 @@
 # attributes of a CGI object.  The following is a list of these variables:
 #
 #
-#   AUTH_TYPE               HTTP_HOST          REMOTE_IDENT
-#   CONTENT_LENGTH          HTTP_NEGOTIATE     REMOTE_USER
-#   CONTENT_TYPE            HTTP_PRAGMA        REQUEST_METHOD
-#   GATEWAY_INTERFACE       HTTP_REFERER       SCRIPT_NAME
-#   HTTP_ACCEPT             HTTP_USER_AGENT    SERVER_NAME
-#   HTTP_ACCEPT_CHARSET     PATH_INFO          SERVER_PORT
-#   HTTP_ACCEPT_ENCODING    PATH_TRANSLATED    SERVER_PROTOCOL
-#   HTTP_ACCEPT_LANGUAGE    QUERY_STRING       SERVER_SOFTWARE
-#   HTTP_CACHE_CONTROL      REMOTE_ADDR
-#   HTTP_FROM               REMOTE_HOST
+#   AUTH_TYPE               HTTP_IF_NONE_MATCH      REMOTE_USER
+#   CONTENT_LENGTH          HTTP_KEEP_ALIVE         REQUEST_METHOD
+#   CONTENT_TYPE            HTTP_NEGOTIATE          SCRIPT_FILENAME
+#   DOCUMENT_ROOT           HTTP_PRAGMA             SCRIPT_NAME
+#   GATEWAY_INTERFACE       HTTP_REFERER            SERVER_ADDR
+#   HTTP_ACCEPT             HTTP_USER_AGENT         SERVER_ADMIN
+#   HTTP_ACCEPT_CHARSET     PATH_INFO               SERVER_NAME
+#   HTTP_ACCEPT_ENCODING    PATH_TRANSLATED         SERVER_PORT
+#   HTTP_ACCEPT_LANGUAGE    QUERY_STRING            SERVER_PROTOCOL
+#   HTTP_CACHE_CONTROL      REMOTE_ADDR             SERVER_SIGNATURE
+#   HTTP_FROM               REMOTE_HOST             SERVER_SOFTWARE
+#   HTTP_HOST               REMOTE_IDENT            UNIQUE_ID
+#   HTTP_IF_MODIFIED_SINCE  REMOTE_PORT
 #
 #
 # For each of these variables, there is a corresponding attribute with the
@@ -293,23 +296,47 @@
 
   # HTTP status codes.
   HTTP_STATUS = {
+    "CONTINUE"            => "100 Continue",
+    "SWITCHING_PROTOCOLS" => "101 Switching Protocols",
     "OK"                  => "200 OK",
+    "CREATED"             => "201 Created",
+    "ACCEPTED"            => "202 Accepted",
+    "NON_AUTHORITATIVE_INFORMATION" => "203 Non-Authoritative Information",
+    "NO_CONTENT"          => "204 No Content",
+    "RESET_CONTENT"       => "205 Reset Content",
     "PARTIAL_CONTENT"     => "206 Partial Content",
     "MULTIPLE_CHOICES"    => "300 Multiple Choices",
     "MOVED"               => "301 Moved Permanently",
     "REDIRECT"            => "302 Found",
+    "SEE_OTHER"           => "303 See Other",
     "NOT_MODIFIED"        => "304 Not Modified",
+    "USE_PROXY"           => "305 Use Proxy",
+    "(UNUSED)"            => "306 (Unused)",
+    "TEMPORARY_REDIRECT"  => "307 Temporary Redirect",
     "BAD_REQUEST"         => "400 Bad Request",
     "AUTH_REQUIRED"       => "401 Authorization Required",
+    "PAYMENT_REQUIRED"    => "402 Payment Required",
     "FORBIDDEN"           => "403 Forbidden",
     "NOT_FOUND"           => "404 Not Found",
     "METHOD_NOT_ALLOWED"  => "405 Method Not Allowed",
     "NOT_ACCEPTABLE"      => "406 Not Acceptable",
+    "PROXY_AUTHENTICATION_REQUIRED" => "407 Proxy Authentication Required",
+    "REQUEST_TIMEOUT"     => "408 Request Timeout",
+    "CONFLICT"            => "409 Conflict",
+    "GONE"                => "410 Gone",
     "LENGTH_REQUIRED"     => "411 Length Required",
     "PRECONDITION_FAILED" => "412 Rrecondition Failed",
+    "REQUEST_ENTITY_TOO_LARGE" => "413 Request Entity Too Large",
+    "REQUEST_URI_TOO_LONG" => "414 Request-URI Too Long",
+    "UNSUPPORTED_MEDIA_TYPE" => "415 Unsupported Media Type",
+    "REQUESTED_RANGE_NOT_SATISFIABLE" => "416 Requested Range Not Satisfiable",
+    "EXPECTATION_FAILED"  => "417 Expectation Failed",
     "SERVER_ERROR"        => "500 Internal Server Error",
     "NOT_IMPLEMENTED"     => "501 Method Not Implemented",
     "BAD_GATEWAY"         => "502 Bad Gateway",
+    "SERVICE_UNAVAILABLE" => "503 Service Unavailable",
+    "GATEWAY_TIMEOUT"     => "504 Gateway Timeout",
+    "HTTP_VERSION_NOT_SUPPORTED" => "505 HTTP Version Not Supported",
     "VARIANT_ALSO_VARIES" => "506 Variant Also Negotiates"
   }
 
@@ -922,19 +949,22 @@
   #
   module QueryExtension
 
-    %w[ CONTENT_LENGTH SERVER_PORT ].each do |env|
+    %w[ CONTENT_LENGTH SERVER_PORT REMOTE_PORT ].each do |env|
       define_method(env.sub(/^HTTP_/n, '').downcase) do
         (val = env_table[env]) && Integer(val)
       end
     end
 
-    %w[ AUTH_TYPE CONTENT_TYPE GATEWAY_INTERFACE PATH_INFO
-        PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST
-        REMOTE_IDENT REMOTE_USER REQUEST_METHOD SCRIPT_NAME
-        SERVER_NAME SERVER_PROTOCOL SERVER_SOFTWARE
+    %w[ AUTH_TYPE CONTENT_TYPE DOCUMENT_ROOT GATEWAY_INTERFACE 
+        PATH_INFO PATH_TRANSLATED QUERY_STRING REMOTE_ADDR 
+        REMOTE_HOST REMOTE_IDENT REMOTE_USER REQUEST_METHOD 
+        SCRIPT_FILENAME SCRIPT_NAME SERVER_ADDR SERVER_ADMIN 
+        SERVER_NAME SERVER_PROTOCOL SERVER_SOFTWARE SERVER_SIGNATURE 
+        UNIQUE_ID 
 
         HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
         HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST
+        HTTP_IF_MODIFIED_SINCE HTTP_IF_NONE_MATCH HTTP_KEEP_ALIVE
         HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT ].each do |env|
       define_method(env.sub(/^HTTP_/n, '').downcase) do
         env_table[env]

--mgIE+9cwyCTt+85Z--

--1PHmS26pdpOR3Xc0
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFDoQoDzdlT34LClWIRAqSLAKDUQtwLFnAtLFdxWEu8+0BISvPbOwCcC8DY
IPZxiGXjsCXfij+iSxOBx1MB
-----END PGP SIGNATURE-----

--1PHmS26pdpOR3Xc0--