[#6864] ruby 1.8.4 rc breaks alias_method/rails in bad ways — "Ara.T.Howard" <ara.t.howard@...>

20 messages 2005/12/09
[#6870] Re: ruby 1.8.4 rc breaks alias_method/rails in bad ways — =?ISO-8859-15?Q?Florian_Gro=DF?= <florgro@...> 2005/12/12

Ara.T.Howard wrote:

[#6872] Re: ruby 1.8.4 rc breaks alias_method/rails in bad ways — ara.t.howard@... 2005/12/12

On Tue, 13 Dec 2005, [ISO-8859-15] Florian Growrote:

[#6873] Re: ruby 1.8.4 rc breaks alias_method/rails in bad ways — James Edward Gray II <james@...> 2005/12/12

On Dec 12, 2005, at 1:19 PM, ara.t.howard@noaa.gov wrote:

[#6874] Re: ruby 1.8.4 rc breaks alias_method/rails in bad ways — ara.t.howard@... 2005/12/12

On Tue, 13 Dec 2005, James Edward Gray II wrote:

[#6891] Time.utc! and Time.localtime! — Daniel Hobe <hobe@...>

Writing a script yesterday I found out, much to my surprise, that the

16 messages 2005/12/14

[#6918] change to yaml in 1.8.4 — ara.t.howard@...

14 messages 2005/12/16

[#6934] 1.8.x, YAML, and release management — Ryan Davis <ryand-ruby@...>

I'm concerned that 1.8.3's acceptance of non-backwards-compatible

28 messages 2005/12/18

[#6996] Problems building 1.8.4 with VS8 C++ Express Edition (cl 14.00) — Austin Ziegler <halostatue@...>

Visual Studio C++ 2005 Express Edition (VS 8.0)

20 messages 2005/12/27

Re: [PATCH] Add Missing HTTP Headers and Status Codes to Ruby CGI

From: Paul Duncan <pabs@...>
Date: 2005-12-23 05:32:38 UTC
List: ruby-core #6986
Matz, anyone?

Any word on this patch?

For what it's worth, it appears to apply cleanly to 1.9 as well (at
least the last time I tried).

* Paul Duncan (pabs@pablotron.org) wrote:
> 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/

> 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]




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

Attachments (1)

signature.asc (189 Bytes, application/pgp-signature)

In This Thread