1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17+ require 'delegate'
18+
1719module Net
1820 autoload :HTTP , 'net/http'
1921end
@@ -31,6 +33,19 @@ class Socket
3133 #
3234 # @api private
3335 class OcspVerifier
36+ # Wraps OpenSSL::OCSP::SingleResponse with the responder URI that supplied it.
37+ #
38+ # @api private
39+ class Response < SimpleDelegator
40+ attr_reader :uri , :original_uri
41+
42+ def initialize ( single_response , uri , original_uri )
43+ super ( single_response )
44+ @uri = uri
45+ @original_uri = original_uri
46+ end
47+ end
48+
3449 include Loggable
3550
3651 # @param [ String ] host_name The host name being verified, for
@@ -228,18 +243,13 @@ def verify_one_responder(uri)
228243 return false
229244 end
230245
231- resp = resp . find_response ( cert_id )
232- unless resp
246+ single_response = resp . find_response ( cert_id )
247+ unless single_response
233248 @resp_errors << "OCSP response from #{ report_uri ( original_uri ,
234249 uri ) } did not include information about the requested certificate"
235250 return false
236251 end
237- # TODO: make a new class instead of patching the stdlib one?
238- resp . instance_variable_set ( :@uri , uri )
239- resp . instance_variable_set ( :@original_uri , original_uri )
240- class << resp
241- attr_reader :uri , :original_uri
242- end
252+ resp = Response . new ( single_response , uri , original_uri )
243253
244254 unless resp . check_validity
245255 @resp_errors << "OCSP response from #{ report_uri ( original_uri ,
0 commit comments