Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby27/share/ruby/uri
File: http.rb
# frozen_string_literal: false
[0] Fix | Delete
# = uri/http.rb
[1] Fix | Delete
#
[2] Fix | Delete
# Author:: Akira Yamada <akira@ruby-lang.org>
[3] Fix | Delete
# License:: You can redistribute it and/or modify it under the same term as Ruby.
[4] Fix | Delete
# Revision:: $Id$
[5] Fix | Delete
#
[6] Fix | Delete
# See URI for general documentation
[7] Fix | Delete
#
[8] Fix | Delete
[9] Fix | Delete
require_relative 'generic'
[10] Fix | Delete
[11] Fix | Delete
module URI
[12] Fix | Delete
[13] Fix | Delete
#
[14] Fix | Delete
# The syntax of HTTP URIs is defined in RFC1738 section 3.3.
[15] Fix | Delete
#
[16] Fix | Delete
# Note that the Ruby URI library allows HTTP URLs containing usernames and
[17] Fix | Delete
# passwords. This is not legal as per the RFC, but used to be
[18] Fix | Delete
# supported in Internet Explorer 5 and 6, before the MS04-004 security
[19] Fix | Delete
# update. See <URL:http://support.microsoft.com/kb/834489>.
[20] Fix | Delete
#
[21] Fix | Delete
class HTTP < Generic
[22] Fix | Delete
# A Default port of 80 for URI::HTTP.
[23] Fix | Delete
DEFAULT_PORT = 80
[24] Fix | Delete
[25] Fix | Delete
# An Array of the available components for URI::HTTP.
[26] Fix | Delete
COMPONENT = %i[
[27] Fix | Delete
scheme
[28] Fix | Delete
userinfo host port
[29] Fix | Delete
path
[30] Fix | Delete
query
[31] Fix | Delete
fragment
[32] Fix | Delete
].freeze
[33] Fix | Delete
[34] Fix | Delete
#
[35] Fix | Delete
# == Description
[36] Fix | Delete
#
[37] Fix | Delete
# Creates a new URI::HTTP object from components, with syntax checking.
[38] Fix | Delete
#
[39] Fix | Delete
# The components accepted are userinfo, host, port, path, query, and
[40] Fix | Delete
# fragment.
[41] Fix | Delete
#
[42] Fix | Delete
# The components should be provided either as an Array, or as a Hash
[43] Fix | Delete
# with keys formed by preceding the component names with a colon.
[44] Fix | Delete
#
[45] Fix | Delete
# If an Array is used, the components must be passed in the
[46] Fix | Delete
# order <code>[userinfo, host, port, path, query, fragment]</code>.
[47] Fix | Delete
#
[48] Fix | Delete
# Example:
[49] Fix | Delete
#
[50] Fix | Delete
# uri = URI::HTTP.build(host: 'www.example.com', path: '/foo/bar')
[51] Fix | Delete
#
[52] Fix | Delete
# uri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
[53] Fix | Delete
# "query", 'fragment'])
[54] Fix | Delete
#
[55] Fix | Delete
# Currently, if passed userinfo components this method generates
[56] Fix | Delete
# invalid HTTP URIs as per RFC 1738.
[57] Fix | Delete
#
[58] Fix | Delete
def self.build(args)
[59] Fix | Delete
tmp = Util.make_components_hash(self, args)
[60] Fix | Delete
super(tmp)
[61] Fix | Delete
end
[62] Fix | Delete
[63] Fix | Delete
#
[64] Fix | Delete
# == Description
[65] Fix | Delete
#
[66] Fix | Delete
# Returns the full path for an HTTP request, as required by Net::HTTP::Get.
[67] Fix | Delete
#
[68] Fix | Delete
# If the URI contains a query, the full path is URI#path + '?' + URI#query.
[69] Fix | Delete
# Otherwise, the path is simply URI#path.
[70] Fix | Delete
#
[71] Fix | Delete
# Example:
[72] Fix | Delete
#
[73] Fix | Delete
# uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true')
[74] Fix | Delete
# uri.request_uri # => "/foo/bar?test=true"
[75] Fix | Delete
#
[76] Fix | Delete
def request_uri
[77] Fix | Delete
return unless @path
[78] Fix | Delete
[79] Fix | Delete
url = @query ? "#@path?#@query" : @path.dup
[80] Fix | Delete
url.start_with?(?/.freeze) ? url : ?/ + url
[81] Fix | Delete
end
[82] Fix | Delete
end
[83] Fix | Delete
[84] Fix | Delete
@@schemes['HTTP'] = HTTP
[85] Fix | Delete
[86] Fix | Delete
end
[87] Fix | Delete
[88] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function