4 # Author:: Akira Yamada <akira@ruby-lang.org>
5 # License:: You can redistribute it and/or modify it under the same term as Ruby.
6 # Revision:: $Id: http.rb 11708 2007-02-12 23:01:19Z shyouhei $
14 # The syntax of HTTP URIs is defined in RFC1738 section 3.3.
16 # Note that the Ruby URI library allows HTTP URLs containing usernames and
17 # passwords. This is not legal as per the RFC, but used to be
18 # supported in Internet Explorer 5 and 6, before the MS04-004 security
19 # update. See <URL:http://support.microsoft.com/kb/834489>.
26 :userinfo, :host, :port,
35 # Create a new URI::HTTP object from components, with syntax checking.
37 # The components accepted are userinfo, host, port, path, query and
40 # The components should be provided either as an Array, or as a Hash
41 # with keys formed by preceding the component names with a colon.
43 # If an Array is used, the components must be passed in the order
44 # [userinfo, host, port, path, query, fragment].
48 # newuri = URI::HTTP.build({:host => 'www.example.com',
49 # :path> => '/foo/bar'})
51 # newuri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
52 # "query", 'fragment'])
54 # Currently, if passed userinfo components this method generates
55 # invalid HTTP URIs as per RFC 1738.
58 tmp = Util::make_components_hash(self, args)
65 # Create a new URI::HTTP object from generic URI components as per
66 # RFC 2396. No HTTP-specific syntax checking (as per RFC 1738) is
69 # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
70 # +opaque+, +query+ and +fragment+, in that order.
74 # uri = URI::HTTP.new(['http', nil, "www.example.com", nil, "/path",
75 # "query", 'fragment'])
84 # Returns the full path for an HTTP request, as required by Net::HTTP::Get.
86 # If the URI contains a query, the full path is URI#path + '?' + URI#query.
87 # Otherwise, the path is simply URI#path.
99 @@schemes['HTTP'] = HTTP