lib/uri/http.rb


DEFINITIONS

This source file includes following functions.


   1  #
   2  # $Id: http.rb,v 1.1 2002/01/10 08:00:51 akira Exp $
   3  #
   4  # Copyright (c) 2001 akira yamada <akira@ruby-lang.org>
   5  # You can redistribute it and/or modify it under the same term as Ruby.
   6  #
   7  
   8  require 'uri/generic'
   9  
  10  module URI
  11  
  12  =begin
  13  
  14  == URI::HTTP
  15  
  16  === Super Class
  17  
  18  ((<URI::Generic>))
  19  
  20  =end
  21  
  22    # RFC1738 section 3.3.
  23    class HTTP < Generic
  24      DEFAULT_PORT = 80
  25  
  26      COMPONENT = [
  27        :scheme, 
  28        :userinfo, :host, :port, 
  29        :path, 
  30        :query, 
  31        :fragment
  32      ].freeze
  33  
  34  =begin
  35  
  36  === Class Methods
  37  
  38  --- URI::HTTP::build
  39      Create a new URI::HTTP object from components of URI::HTTP with
  40      check.  It is scheme, userinfo, host, port, path, query and
  41      fragment. It provided by an Array of a Hash.
  42  
  43  --- URI::HTTP::new
  44      Create a new URI::HTTP object from ``generic'' components with no
  45      check.
  46  
  47  =end
  48  
  49      def self.build(args)
  50        tmp = Util::make_components_hash(self, args)
  51        return super(tmp)
  52      end
  53  
  54      def initialize(*arg)
  55        super(*arg)
  56      end
  57  
  58  =begin
  59  
  60  === Instance Methods
  61  
  62  --- URI::HTTP#request_uri
  63  
  64  =end
  65      def request_uri
  66        r = path_query
  67        if r[0] != ?/
  68          r = '/' + r
  69        end
  70  
  71        r
  72      end
  73    end # HTTP
  74  
  75    @@schemes['HTTP'] = HTTP
  76  end # URI