0001-Completed-CGI-documentation.patch

Kuba Fietkiewicz, 05/25/2011 05:42 AM

Download (4.24 KB)

View differences:

lib/cgi/cookie.rb
1
##
2
# Cookie methods in the CGI module
3
#
1 4
class CGI
2 5
  @@accept_charset="UTF-8" unless defined?(@@accept_charset)
3 6
  # Class representing an HTTP cookie.
lib/cgi/core.rb
1
#--
1
##
2 2
# Methods for generating HTML, parsing CGI-related parameters, and
3 3
# generating HTTP responses.
4
#++
4
#
5 5
class CGI
6 6

  
7 7
  $CGI_ENV = ENV    # for FCGI support
......
17 17

  
18 18
  REVISION = '$Id$' #:nodoc:
19 19

  
20
  # Whether processing will be required in binary vs text
20 21
  NEEDS_BINMODE = File::BINARY != 0
21 22

  
22 23
  # Path separators in different environments.
......
450 451
      @params.update(hash)
451 452
    end
452 453

  
454
    ##
455
    # Parses multipart form elements according to 
456
    #   http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
457
    #
458
    # Returns a hash of multipart form parameters with bodies of type StringIO or 
459
    # Tempfile depending on whether the multipart form element exceeds 10 KB
460
    #
461
    #   params[name => body]
462
    #
453 463
    def read_multipart(boundary, content_length)
454 464
      ## read first boundary
455 465
      stdin = $stdin
......
655 665
    end
656 666
    private :initialize_query
657 667

  
668
    # Returns whether the form contained multipart/form-data
658 669
    def multipart?
659 670
      @multipart
660 671
    end
......
705 716
  #
706 717
  #   CGI.accept_charset = "EUC-JP"
707 718
  #
708

  
709 719
  @@accept_charset="UTF-8"
710 720

  
711 721
  # Return the accept character set for all new CGI instances.
lib/cgi/html.rb
1
##
2
# HTML element generating methods
3
#
1 4
class CGI
2 5
  # Base module for HTML-generation mixins.
3 6
  #
lib/cgi/session.rb
12 12
require 'cgi'
13 13
require 'tmpdir'
14 14

  
15
class CGI
15
class CGI #:nodoc:
16 16

  
17 17
  # == Overview
18 18
  #
lib/cgi/session/pstore.rb
12 12
require 'cgi/session'
13 13
require 'pstore'
14 14

  
15
class CGI
16
  class Session
15
class CGI #:nodoc:
16
  class Session #:nodoc:
17 17
    # PStore-based session storage class.
18 18
    #
19 19
    # This builds upon the top-level PStore class provided by the
lib/cgi/util.rb
1
##
2
# Utility methods for escaping and prettifying HTML, and for date formatting.
3
#
1 4
class CGI
2 5
  @@accept_charset="UTF-8" unless defined?(@@accept_charset)
3 6
  # URL-encode a string.
......
20 23
    str.valid_encoding? ? str : str.force_encoding(string.encoding)
21 24
  end
22 25

  
26
  # The set of special characters and their escaped values
23 27
  TABLE_FOR_ESCAPE_HTML__ = {
24 28
    '&' => '&',
25 29
    '"' => '"',
......
84 88
    end
85 89
  end
86 90

  
87
  # Synonym for CGI.escapeHTML.
91
  # Synonym for CGI::escapeHTML(str)
88 92
  def CGI::escape_html(str)
89 93
    escapeHTML(str)
90 94
  end
91

  
92
  # Synonym for CGI.unescapeHTML.
95
  
96
  # Synonym for CGI::unescapeHTML(str)
93 97
  def CGI::unescape_html(str)
94 98
    unescapeHTML(str)
95 99
  end
......
139 143
    end
140 144
  end
141 145

  
142
  # Synonym for CGI.escapeElement.
146
  # Synonym for CGI::escapeElement(str)
143 147
  def CGI::escape_element(str)
144 148
    escapeElement(str)
145 149
  end
146

  
147
  # Synonym for CGI.unescapeElement.
150
  
151
  # Synonym for CGI::unescapeElement(str)
148 152
  def CGI::unescape_element(str)
149 153
    unescapeElement(str)
150 154
  end
151
-