net-http 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{LICENSE.txt → BSDL} +3 -3
- data/COPYING +56 -0
- data/README.md +2 -1
- data/lib/net/http/header.rb +1 -1
- data/lib/net/http/requests.rb +5 -0
- data/lib/net/http.rb +115 -34
- metadata +8 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c03edd74b23392c1b0f19f66370d554d8f1609fe7353165388f35055d9a24e1c
         | 
| 4 | 
            +
              data.tar.gz: f5b94529123018fb71d778be8ae2675f16d3f6e49d99a19da9303ad1f23bcea2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f6f7879eb1abda08f6ffbdeec8918af799fbea576008d3ed1902a9c2c9a97b9ede394fdc50dccee513c413a1427e4a37a8db5623d8fdcec0c2e496ad661cf99e
         | 
| 7 | 
            +
              data.tar.gz: f66425b565071ed067b1786e2553819e92f9243db950d6e57298299df43cb7c957dc7b29e1604cf6f227f43cda8957a3e97c6038d4f52ad678ad13226f9f1c66
         | 
    
        data/{LICENSE.txt → BSDL}
    RENAMED
    
    | @@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without | |
| 4 4 | 
             
            modification, are permitted provided that the following conditions
         | 
| 5 5 | 
             
            are met:
         | 
| 6 6 | 
             
            1. Redistributions of source code must retain the above copyright
         | 
| 7 | 
            -
            notice, this list of conditions and the following disclaimer.
         | 
| 7 | 
            +
               notice, this list of conditions and the following disclaimer.
         | 
| 8 8 | 
             
            2. Redistributions in binary form must reproduce the above copyright
         | 
| 9 | 
            -
            notice, this list of conditions and the following disclaimer in the
         | 
| 10 | 
            -
            documentation and/or other materials provided with the distribution.
         | 
| 9 | 
            +
               notice, this list of conditions and the following disclaimer in the
         | 
| 10 | 
            +
               documentation and/or other materials provided with the distribution.
         | 
| 11 11 |  | 
| 12 12 | 
             
            THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
         | 
| 13 13 | 
             
            ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         | 
    
        data/COPYING
    ADDED
    
    | @@ -0,0 +1,56 @@ | |
| 1 | 
            +
            Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
         | 
| 2 | 
            +
            You can redistribute it and/or modify it under either the terms of the
         | 
| 3 | 
            +
            2-clause BSDL (see the file BSDL), or the conditions below:
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            1. You may make and give away verbatim copies of the source form of the
         | 
| 6 | 
            +
               software without restriction, provided that you duplicate all of the
         | 
| 7 | 
            +
               original copyright notices and associated disclaimers.
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            2. You may modify your copy of the software in any way, provided that
         | 
| 10 | 
            +
               you do at least ONE of the following:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
               a. place your modifications in the Public Domain or otherwise
         | 
| 13 | 
            +
                  make them Freely Available, such as by posting said
         | 
| 14 | 
            +
                  modifications to Usenet or an equivalent medium, or by allowing
         | 
| 15 | 
            +
                  the author to include your modifications in the software.
         | 
| 16 | 
            +
             | 
| 17 | 
            +
               b. use the modified software only within your corporation or
         | 
| 18 | 
            +
                  organization.
         | 
| 19 | 
            +
             | 
| 20 | 
            +
               c. give non-standard binaries non-standard names, with
         | 
| 21 | 
            +
                  instructions on where to get the original software distribution.
         | 
| 22 | 
            +
             | 
| 23 | 
            +
               d. make other distribution arrangements with the author.
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            3. You may distribute the software in object code or binary form,
         | 
| 26 | 
            +
               provided that you do at least ONE of the following:
         | 
| 27 | 
            +
             | 
| 28 | 
            +
               a. distribute the binaries and library files of the software,
         | 
| 29 | 
            +
                  together with instructions (in the manual page or equivalent)
         | 
| 30 | 
            +
                  on where to get the original distribution.
         | 
| 31 | 
            +
             | 
| 32 | 
            +
               b. accompany the distribution with the machine-readable source of
         | 
| 33 | 
            +
                  the software.
         | 
| 34 | 
            +
             | 
| 35 | 
            +
               c. give non-standard binaries non-standard names, with
         | 
| 36 | 
            +
                  instructions on where to get the original software distribution.
         | 
| 37 | 
            +
             | 
| 38 | 
            +
               d. make other distribution arrangements with the author.
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            4. You may modify and include the part of the software into any other
         | 
| 41 | 
            +
               software (possibly commercial).  But some files in the distribution
         | 
| 42 | 
            +
               are not written by the author, so that they are not under these terms.
         | 
| 43 | 
            +
             | 
| 44 | 
            +
               For the list of those files and their copying conditions, see the
         | 
| 45 | 
            +
               file LEGAL.
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            5. The scripts and library files supplied as input to or produced as
         | 
| 48 | 
            +
               output from the software do not automatically fall under the
         | 
| 49 | 
            +
               copyright of the software, but belong to whomever generated them,
         | 
| 50 | 
            +
               and may be sold commercially, and may be aggregated with this
         | 
| 51 | 
            +
               software.
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
         | 
| 54 | 
            +
               IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
         | 
| 55 | 
            +
               WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
         | 
| 56 | 
            +
               PURPOSE.
         | 
    
        data/README.md
    CHANGED
    
    | @@ -2,7 +2,8 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Net::HTTP provides a rich library which can be used to build HTTP
         | 
| 4 4 | 
             
            user-agents.  For more details about HTTP see
         | 
| 5 | 
            -
            [ | 
| 5 | 
            +
            [RFC9110 HTTP Semantics](https://www.ietf.org/rfc/rfc9110.html) and
         | 
| 6 | 
            +
            [RFC9112 HTTP/1.1](https://www.ietf.org/rfc/rfc9112.html).
         | 
| 6 7 |  | 
| 7 8 | 
             
            Net::HTTP is designed to work closely with URI.  URI::HTTP#host,
         | 
| 8 9 | 
             
            URI::HTTP#port and URI::HTTP#request_uri are designed to work with
         | 
    
        data/lib/net/http/header.rb
    CHANGED
    
    | @@ -491,7 +491,7 @@ module Net::HTTPHeader | |
| 491 491 | 
             
              alias canonical_each each_capitalized
         | 
| 492 492 |  | 
| 493 493 | 
             
              def capitalize(name)
         | 
| 494 | 
            -
                name.to_s.split( | 
| 494 | 
            +
                name.to_s.split('-'.freeze).map {|s| s.capitalize }.join('-'.freeze)
         | 
| 495 495 | 
             
              end
         | 
| 496 496 | 
             
              private :capitalize
         | 
| 497 497 |  | 
    
        data/lib/net/http/requests.rb
    CHANGED
    
    | @@ -124,6 +124,11 @@ end | |
| 124 124 | 
             
            # - {Idempotent}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods]: yes.
         | 
| 125 125 | 
             
            # - {Cacheable}[https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Cacheable_methods]: no.
         | 
| 126 126 | 
             
            #
         | 
| 127 | 
            +
            # Related:
         | 
| 128 | 
            +
            #
         | 
| 129 | 
            +
            # - Net::HTTP.put: sends +PUT+ request, returns response object.
         | 
| 130 | 
            +
            # - Net::HTTP#put: sends +PUT+ request, returns response object.
         | 
| 131 | 
            +
            #
         | 
| 127 132 | 
             
            class Net::HTTP::Put < Net::HTTPRequest
         | 
| 128 133 | 
             
              METHOD = 'PUT'
         | 
| 129 134 | 
             
              REQUEST_HAS_BODY = true
         | 
    
        data/lib/net/http.rb
    CHANGED
    
    | @@ -67,6 +67,8 @@ module Net   #:nodoc: | |
| 67 67 | 
             
              #     Net::HTTP.post(uri, data)
         | 
| 68 68 | 
             
              #     params = {title: 'foo', body: 'bar', userId: 1}
         | 
| 69 69 | 
             
              #     Net::HTTP.post_form(uri, params)
         | 
| 70 | 
            +
              #     data = '{"title": "foo", "body": "bar", "userId": 1}'
         | 
| 71 | 
            +
              #     Net::HTTP.put(uri, data)
         | 
| 70 72 | 
             
              #
         | 
| 71 73 | 
             
              # - If performance is important, consider using sessions, which lower request overhead.
         | 
| 72 74 | 
             
              #   This {session}[rdoc-ref:Net::HTTP@Sessions] has multiple requests for
         | 
| @@ -456,6 +458,10 @@ module Net   #:nodoc: | |
| 456 458 | 
             
              #
         | 
| 457 459 | 
             
              # == What's Here
         | 
| 458 460 | 
             
              #
         | 
| 461 | 
            +
              # First, what's elsewhere. Class Net::HTTP:
         | 
| 462 | 
            +
              #
         | 
| 463 | 
            +
              # - Inherits from {class Object}[https://docs.ruby-lang.org/en/master/Object.html#class-Object-label-What-27s+Here].
         | 
| 464 | 
            +
              #
         | 
| 459 465 | 
             
              # This is a categorized summary of methods and attributes.
         | 
| 460 466 | 
             
              #
         | 
| 461 467 | 
             
              # === \Net::HTTP Objects
         | 
| @@ -520,6 +526,8 @@ module Net   #:nodoc: | |
| 520 526 | 
             
              #   Sends a POST request with form data and returns a response object.
         | 
| 521 527 | 
             
              # - {::post}[rdoc-ref:Net::HTTP.post]:
         | 
| 522 528 | 
             
              #   Sends a POST request with data and returns a response object.
         | 
| 529 | 
            +
              # - {::put}[rdoc-ref:Net::HTTP.put]:
         | 
| 530 | 
            +
              #   Sends a PUT request with data and returns a response object.
         | 
| 523 531 | 
             
              # - {#copy}[rdoc-ref:Net::HTTP#copy]:
         | 
| 524 532 | 
             
              #   Sends a COPY request and returns a response object.
         | 
| 525 533 | 
             
              # - {#delete}[rdoc-ref:Net::HTTP#delete]:
         | 
| @@ -722,7 +730,7 @@ module Net   #:nodoc: | |
| 722 730 | 
             
              class HTTP < Protocol
         | 
| 723 731 |  | 
| 724 732 | 
             
                # :stopdoc:
         | 
| 725 | 
            -
                VERSION = "0. | 
| 733 | 
            +
                VERSION = "0.5.0"
         | 
| 726 734 | 
             
                HTTPVersion = '1.1'
         | 
| 727 735 | 
             
                begin
         | 
| 728 736 | 
             
                  require 'zlib'
         | 
| @@ -889,6 +897,39 @@ module Net   #:nodoc: | |
| 889 897 | 
             
                  }
         | 
| 890 898 | 
             
                end
         | 
| 891 899 |  | 
| 900 | 
            +
                # Sends a PUT request to the server; returns a Net::HTTPResponse object.
         | 
| 901 | 
            +
                #
         | 
| 902 | 
            +
                # Argument +url+ must be a URL;
         | 
| 903 | 
            +
                # argument +data+ must be a string:
         | 
| 904 | 
            +
                #
         | 
| 905 | 
            +
                #   _uri = uri.dup
         | 
| 906 | 
            +
                #   _uri.path = '/posts'
         | 
| 907 | 
            +
                #   data = '{"title": "foo", "body": "bar", "userId": 1}'
         | 
| 908 | 
            +
                #   headers = {'content-type': 'application/json'}
         | 
| 909 | 
            +
                #   res = Net::HTTP.put(_uri, data, headers) # => #<Net::HTTPCreated 201 Created readbody=true>
         | 
| 910 | 
            +
                #   puts res.body
         | 
| 911 | 
            +
                #
         | 
| 912 | 
            +
                # Output:
         | 
| 913 | 
            +
                #
         | 
| 914 | 
            +
                #   {
         | 
| 915 | 
            +
                #     "title": "foo",
         | 
| 916 | 
            +
                #     "body": "bar",
         | 
| 917 | 
            +
                #     "userId": 1,
         | 
| 918 | 
            +
                #     "id": 101
         | 
| 919 | 
            +
                #   }
         | 
| 920 | 
            +
                #
         | 
| 921 | 
            +
                # Related:
         | 
| 922 | 
            +
                #
         | 
| 923 | 
            +
                # - Net::HTTP::Put: request class for \HTTP method +PUT+.
         | 
| 924 | 
            +
                # - Net::HTTP#put: convenience method for \HTTP method +PUT+.
         | 
| 925 | 
            +
                #
         | 
| 926 | 
            +
                def HTTP.put(url, data, header = nil)
         | 
| 927 | 
            +
                  start(url.hostname, url.port,
         | 
| 928 | 
            +
                        :use_ssl => url.scheme == 'https' ) {|http|
         | 
| 929 | 
            +
                    http.put(url, data, header)
         | 
| 930 | 
            +
                  }
         | 
| 931 | 
            +
                end
         | 
| 932 | 
            +
             | 
| 892 933 | 
             
                #
         | 
| 893 934 | 
             
                # \HTTP session management
         | 
| 894 935 | 
             
                #
         | 
| @@ -1062,7 +1103,7 @@ module Net   #:nodoc: | |
| 1062 1103 | 
             
                # For proxy-defining arguments +p_addr+ through +p_no_proxy+,
         | 
| 1063 1104 | 
             
                # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
         | 
| 1064 1105 | 
             
                #
         | 
| 1065 | 
            -
                def HTTP.new(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil, p_no_proxy = nil)
         | 
| 1106 | 
            +
                def HTTP.new(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil, p_no_proxy = nil, p_use_ssl = nil)
         | 
| 1066 1107 | 
             
                  http = super address, port
         | 
| 1067 1108 |  | 
| 1068 1109 | 
             
                  if proxy_class? then # from Net::HTTP::Proxy()
         | 
| @@ -1071,6 +1112,7 @@ module Net   #:nodoc: | |
| 1071 1112 | 
             
                    http.proxy_port     = @proxy_port
         | 
| 1072 1113 | 
             
                    http.proxy_user     = @proxy_user
         | 
| 1073 1114 | 
             
                    http.proxy_pass     = @proxy_pass
         | 
| 1115 | 
            +
                    http.proxy_use_ssl  = @proxy_use_ssl
         | 
| 1074 1116 | 
             
                  elsif p_addr == :ENV then
         | 
| 1075 1117 | 
             
                    http.proxy_from_env = true
         | 
| 1076 1118 | 
             
                  else
         | 
| @@ -1082,34 +1124,67 @@ module Net   #:nodoc: | |
| 1082 1124 | 
             
                    http.proxy_port    = p_port || default_port
         | 
| 1083 1125 | 
             
                    http.proxy_user    = p_user
         | 
| 1084 1126 | 
             
                    http.proxy_pass    = p_pass
         | 
| 1127 | 
            +
                    http.proxy_use_ssl = p_use_ssl
         | 
| 1085 1128 | 
             
                  end
         | 
| 1086 1129 |  | 
| 1087 1130 | 
             
                  http
         | 
| 1088 1131 | 
             
                end
         | 
| 1089 1132 |  | 
| 1133 | 
            +
                class << HTTP
         | 
| 1134 | 
            +
                  # Allows to set the default configuration that will be used
         | 
| 1135 | 
            +
                  # when creating a new connection.
         | 
| 1136 | 
            +
                  #
         | 
| 1137 | 
            +
                  # Example:
         | 
| 1138 | 
            +
                  #
         | 
| 1139 | 
            +
                  #   Net::HTTP.default_configuration = {
         | 
| 1140 | 
            +
                  #     read_timeout: 1,
         | 
| 1141 | 
            +
                  #     write_timeout: 1
         | 
| 1142 | 
            +
                  #   }
         | 
| 1143 | 
            +
                  #   http = Net::HTTP.new(hostname)
         | 
| 1144 | 
            +
                  #   http.open_timeout   # => 60
         | 
| 1145 | 
            +
                  #   http.read_timeout   # => 1
         | 
| 1146 | 
            +
                  #   http.write_timeout  # => 1
         | 
| 1147 | 
            +
                  #
         | 
| 1148 | 
            +
                  attr_accessor :default_configuration
         | 
| 1149 | 
            +
                end
         | 
| 1150 | 
            +
             | 
| 1090 1151 | 
             
                # Creates a new \Net::HTTP object for the specified server address,
         | 
| 1091 1152 | 
             
                # without opening the TCP connection or initializing the \HTTP session.
         | 
| 1092 1153 | 
             
                # The +address+ should be a DNS hostname or IP address.
         | 
| 1093 1154 | 
             
                def initialize(address, port = nil) # :nodoc:
         | 
| 1155 | 
            +
                  defaults = {
         | 
| 1156 | 
            +
                    keep_alive_timeout: 2,
         | 
| 1157 | 
            +
                    close_on_empty_response: false,
         | 
| 1158 | 
            +
                    open_timeout: 60,
         | 
| 1159 | 
            +
                    read_timeout: 60,
         | 
| 1160 | 
            +
                    write_timeout: 60,
         | 
| 1161 | 
            +
                    continue_timeout: nil,
         | 
| 1162 | 
            +
                    max_retries: 1,
         | 
| 1163 | 
            +
                    debug_output: nil,
         | 
| 1164 | 
            +
                    response_body_encoding: false,
         | 
| 1165 | 
            +
                    ignore_eof: true
         | 
| 1166 | 
            +
                  }
         | 
| 1167 | 
            +
                  options = defaults.merge(self.class.default_configuration || {})
         | 
| 1168 | 
            +
             | 
| 1094 1169 | 
             
                  @address = address
         | 
| 1095 1170 | 
             
                  @port    = (port || HTTP.default_port)
         | 
| 1096 1171 | 
             
                  @ipaddr = nil
         | 
| 1097 1172 | 
             
                  @local_host = nil
         | 
| 1098 1173 | 
             
                  @local_port = nil
         | 
| 1099 1174 | 
             
                  @curr_http_version = HTTPVersion
         | 
| 1100 | 
            -
                  @keep_alive_timeout =  | 
| 1175 | 
            +
                  @keep_alive_timeout = options[:keep_alive_timeout]
         | 
| 1101 1176 | 
             
                  @last_communicated = nil
         | 
| 1102 | 
            -
                  @close_on_empty_response =  | 
| 1177 | 
            +
                  @close_on_empty_response = options[:close_on_empty_response]
         | 
| 1103 1178 | 
             
                  @socket  = nil
         | 
| 1104 1179 | 
             
                  @started = false
         | 
| 1105 | 
            -
                  @open_timeout =  | 
| 1106 | 
            -
                  @read_timeout =  | 
| 1107 | 
            -
                  @write_timeout =  | 
| 1108 | 
            -
                  @continue_timeout =  | 
| 1109 | 
            -
                  @max_retries =  | 
| 1110 | 
            -
                  @debug_output =  | 
| 1111 | 
            -
                  @response_body_encoding =  | 
| 1112 | 
            -
                  @ignore_eof =  | 
| 1180 | 
            +
                  @open_timeout = options[:open_timeout]
         | 
| 1181 | 
            +
                  @read_timeout = options[:read_timeout]
         | 
| 1182 | 
            +
                  @write_timeout = options[:write_timeout]
         | 
| 1183 | 
            +
                  @continue_timeout = options[:continue_timeout]
         | 
| 1184 | 
            +
                  @max_retries = options[:max_retries]
         | 
| 1185 | 
            +
                  @debug_output = options[:debug_output]
         | 
| 1186 | 
            +
                  @response_body_encoding = options[:response_body_encoding]
         | 
| 1187 | 
            +
                  @ignore_eof = options[:ignore_eof]
         | 
| 1113 1188 |  | 
| 1114 1189 | 
             
                  @proxy_from_env = false
         | 
| 1115 1190 | 
             
                  @proxy_uri      = nil
         | 
| @@ -1117,6 +1192,7 @@ module Net   #:nodoc: | |
| 1117 1192 | 
             
                  @proxy_port     = nil
         | 
| 1118 1193 | 
             
                  @proxy_user     = nil
         | 
| 1119 1194 | 
             
                  @proxy_pass     = nil
         | 
| 1195 | 
            +
                  @proxy_use_ssl  = nil
         | 
| 1120 1196 |  | 
| 1121 1197 | 
             
                  @use_ssl = false
         | 
| 1122 1198 | 
             
                  @ssl_context = nil
         | 
| @@ -1251,6 +1327,7 @@ module Net   #:nodoc: | |
| 1251 1327 | 
             
                # Sets the proxy password;
         | 
| 1252 1328 | 
             
                # see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
         | 
| 1253 1329 | 
             
                attr_writer :proxy_pass
         | 
| 1330 | 
            +
                attr_writer :proxy_use_ssl
         | 
| 1254 1331 |  | 
| 1255 1332 | 
             
                # Returns the IP address for the connection.
         | 
| 1256 1333 | 
             
                #
         | 
| @@ -1440,23 +1517,6 @@ module Net   #:nodoc: | |
| 1440 1517 | 
             
                  @use_ssl = flag
         | 
| 1441 1518 | 
             
                end
         | 
| 1442 1519 |  | 
| 1443 | 
            -
                SSL_IVNAMES = [
         | 
| 1444 | 
            -
                  :@ca_file,
         | 
| 1445 | 
            -
                  :@ca_path,
         | 
| 1446 | 
            -
                  :@cert,
         | 
| 1447 | 
            -
                  :@cert_store,
         | 
| 1448 | 
            -
                  :@ciphers,
         | 
| 1449 | 
            -
                  :@extra_chain_cert,
         | 
| 1450 | 
            -
                  :@key,
         | 
| 1451 | 
            -
                  :@ssl_timeout,
         | 
| 1452 | 
            -
                  :@ssl_version,
         | 
| 1453 | 
            -
                  :@min_version,
         | 
| 1454 | 
            -
                  :@max_version,
         | 
| 1455 | 
            -
                  :@verify_callback,
         | 
| 1456 | 
            -
                  :@verify_depth,
         | 
| 1457 | 
            -
                  :@verify_mode,
         | 
| 1458 | 
            -
                  :@verify_hostname,
         | 
| 1459 | 
            -
                ] # :nodoc:
         | 
| 1460 1520 | 
             
                SSL_ATTRIBUTES = [
         | 
| 1461 1521 | 
             
                  :ca_file,
         | 
| 1462 1522 | 
             
                  :ca_path,
         | 
| @@ -1475,6 +1535,8 @@ module Net   #:nodoc: | |
| 1475 1535 | 
             
                  :verify_hostname,
         | 
| 1476 1536 | 
             
                ] # :nodoc:
         | 
| 1477 1537 |  | 
| 1538 | 
            +
                SSL_IVNAMES = SSL_ATTRIBUTES.map { |a| "@#{a}".to_sym } # :nodoc:
         | 
| 1539 | 
            +
             | 
| 1478 1540 | 
             
                # Sets or returns the path to a CA certification file in PEM format.
         | 
| 1479 1541 | 
             
                attr_accessor :ca_file
         | 
| 1480 1542 |  | 
| @@ -1610,7 +1672,13 @@ module Net   #:nodoc: | |
| 1610 1672 | 
             
                  debug "opened"
         | 
| 1611 1673 | 
             
                  if use_ssl?
         | 
| 1612 1674 | 
             
                    if proxy?
         | 
| 1613 | 
            -
                       | 
| 1675 | 
            +
                      if @proxy_use_ssl
         | 
| 1676 | 
            +
                        proxy_sock = OpenSSL::SSL::SSLSocket.new(s)
         | 
| 1677 | 
            +
                        ssl_socket_connect(proxy_sock, @open_timeout)
         | 
| 1678 | 
            +
                      else
         | 
| 1679 | 
            +
                        proxy_sock = s
         | 
| 1680 | 
            +
                      end
         | 
| 1681 | 
            +
                      proxy_sock = BufferedIO.new(proxy_sock, read_timeout: @read_timeout,
         | 
| 1614 1682 | 
             
                                                  write_timeout: @write_timeout,
         | 
| 1615 1683 | 
             
                                                  continue_timeout: @continue_timeout,
         | 
| 1616 1684 | 
             
                                                  debug_output: @debug_output)
         | 
| @@ -1621,8 +1689,8 @@ module Net   #:nodoc: | |
| 1621 1689 | 
             
                        buf << "Proxy-Authorization: Basic #{credential}\r\n"
         | 
| 1622 1690 | 
             
                      end
         | 
| 1623 1691 | 
             
                      buf << "\r\n"
         | 
| 1624 | 
            -
                       | 
| 1625 | 
            -
                      HTTPResponse.read_new( | 
| 1692 | 
            +
                      proxy_sock.write(buf)
         | 
| 1693 | 
            +
                      HTTPResponse.read_new(proxy_sock).value
         | 
| 1626 1694 | 
             
                      # assuming nothing left in buffers after successful CONNECT response
         | 
| 1627 1695 | 
             
                    end
         | 
| 1628 1696 |  | 
| @@ -1730,13 +1798,14 @@ module Net   #:nodoc: | |
| 1730 1798 | 
             
                @proxy_port = nil
         | 
| 1731 1799 | 
             
                @proxy_user = nil
         | 
| 1732 1800 | 
             
                @proxy_pass = nil
         | 
| 1801 | 
            +
                @proxy_use_ssl = nil
         | 
| 1733 1802 |  | 
| 1734 1803 | 
             
                # Creates an \HTTP proxy class which behaves like \Net::HTTP, but
         | 
| 1735 1804 | 
             
                # performs all access via the specified proxy.
         | 
| 1736 1805 | 
             
                #
         | 
| 1737 1806 | 
             
                # This class is obsolete.  You may pass these same parameters directly to
         | 
| 1738 1807 | 
             
                # \Net::HTTP.new.  See Net::HTTP.new for details of the arguments.
         | 
| 1739 | 
            -
                def HTTP.Proxy(p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil) #:nodoc:
         | 
| 1808 | 
            +
                def HTTP.Proxy(p_addr = :ENV, p_port = nil, p_user = nil, p_pass = nil, p_use_ssl = nil) #:nodoc:
         | 
| 1740 1809 | 
             
                  return self unless p_addr
         | 
| 1741 1810 |  | 
| 1742 1811 | 
             
                  Class.new(self) {
         | 
| @@ -1754,6 +1823,7 @@ module Net   #:nodoc: | |
| 1754 1823 |  | 
| 1755 1824 | 
             
                    @proxy_user = p_user
         | 
| 1756 1825 | 
             
                    @proxy_pass = p_pass
         | 
| 1826 | 
            +
                    @proxy_use_ssl = p_use_ssl
         | 
| 1757 1827 | 
             
                  }
         | 
| 1758 1828 | 
             
                end
         | 
| 1759 1829 |  | 
| @@ -1778,6 +1848,9 @@ module Net   #:nodoc: | |
| 1778 1848 | 
             
                  # Returns the password for accessing the proxy, or +nil+ if none;
         | 
| 1779 1849 | 
             
                  # see Net::HTTP@Proxy+Server.
         | 
| 1780 1850 | 
             
                  attr_reader :proxy_pass
         | 
| 1851 | 
            +
             | 
| 1852 | 
            +
                  # Use SSL when talking to the proxy. If Net::HTTP does not use a proxy, nil.
         | 
| 1853 | 
            +
                  attr_reader :proxy_use_ssl
         | 
| 1781 1854 | 
             
                end
         | 
| 1782 1855 |  | 
| 1783 1856 | 
             
                # Returns +true+ if a proxy server is defined, +false+ otherwise;
         | 
| @@ -2012,6 +2085,11 @@ module Net   #:nodoc: | |
| 2012 2085 | 
             
                #   http = Net::HTTP.new(hostname)
         | 
| 2013 2086 | 
             
                #   http.put('/todos/1', data) # => #<Net::HTTPOK 200 OK readbody=true>
         | 
| 2014 2087 | 
             
                #
         | 
| 2088 | 
            +
                # Related:
         | 
| 2089 | 
            +
                #
         | 
| 2090 | 
            +
                # - Net::HTTP::Put: request class for \HTTP method PUT.
         | 
| 2091 | 
            +
                # - Net::HTTP.put: sends PUT request, returns response body.
         | 
| 2092 | 
            +
                #
         | 
| 2015 2093 | 
             
                def put(path, data, initheader = nil)
         | 
| 2016 2094 | 
             
                  request(Put.new(path, initheader), data)
         | 
| 2017 2095 | 
             
                end
         | 
| @@ -2350,7 +2428,10 @@ module Net   #:nodoc: | |
| 2350 2428 | 
             
                      res
         | 
| 2351 2429 | 
             
                    }
         | 
| 2352 2430 | 
             
                    res.reading_body(@socket, req.response_body_permitted?) {
         | 
| 2353 | 
            -
                       | 
| 2431 | 
            +
                      if block_given?
         | 
| 2432 | 
            +
                        count = max_retries # Don't restart in the middle of a download
         | 
| 2433 | 
            +
                        yield res
         | 
| 2434 | 
            +
                      end
         | 
| 2354 2435 | 
             
                    }
         | 
| 2355 2436 | 
             
                  rescue Net::OpenTimeout
         | 
| 2356 2437 | 
             
                    raise
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: net-http
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - NARUSE, Yui
         | 
| 8 | 
            -
            autorequire:
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-11-07 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: uri
         | 
| @@ -31,8 +31,9 @@ executables: [] | |
| 31 31 | 
             
            extensions: []
         | 
| 32 32 | 
             
            extra_rdoc_files: []
         | 
| 33 33 | 
             
            files:
         | 
| 34 | 
            +
            - BSDL
         | 
| 35 | 
            +
            - COPYING
         | 
| 34 36 | 
             
            - Gemfile
         | 
| 35 | 
            -
            - LICENSE.txt
         | 
| 36 37 | 
             
            - README.md
         | 
| 37 38 | 
             
            - Rakefile
         | 
| 38 39 | 
             
            - bin/console
         | 
| @@ -59,7 +60,7 @@ licenses: | |
| 59 60 | 
             
            metadata:
         | 
| 60 61 | 
             
              homepage_uri: https://github.com/ruby/net-http
         | 
| 61 62 | 
             
              source_code_uri: https://github.com/ruby/net-http
         | 
| 62 | 
            -
            post_install_message:
         | 
| 63 | 
            +
            post_install_message: 
         | 
| 63 64 | 
             
            rdoc_options: []
         | 
| 64 65 | 
             
            require_paths:
         | 
| 65 66 | 
             
            - lib
         | 
| @@ -74,8 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 74 75 | 
             
                - !ruby/object:Gem::Version
         | 
| 75 76 | 
             
                  version: '0'
         | 
| 76 77 | 
             
            requirements: []
         | 
| 77 | 
            -
            rubygems_version: 3. | 
| 78 | 
            -
            signing_key:
         | 
| 78 | 
            +
            rubygems_version: 3.5.11
         | 
| 79 | 
            +
            signing_key: 
         | 
| 79 80 | 
             
            specification_version: 4
         | 
| 80 81 | 
             
            summary: HTTP client api for Ruby.
         | 
| 81 82 | 
             
            test_files: []
         |