Skip to content

Gem will not communicate with IRUS HTTPS server #1

@calvinbutcher

Description

@calvinbutcher

The IRUS gem is a wrapper for "openurl" (https://github.com/openurl/openurl). This, in turn, is a wrapper for the Ruby Net:HTTP library class. The openurl gem does not provide an accessor for the "use_ssl" method. We managed to sidestep this issue by cloning the IRUS gem and hacking it with the following code:

irus_analytics_service.rb (https://github.com/uohull/irus_analytics/blob/master/lib/irus_analytics/irus_analytics_service.rb)

      uri = URI.parse('https://irus.jisc.ac.uk/counter/test')

      my_http_client = Net::HTTP.new(uri.host, uri.port)
      my_http_client.use_ssl = true
      my_http_client.open_timeout = 3
      my_http_client.read_timeout = 5

      // *******************************************************************************
      // our hack re-sets the transport with a new instance of Net::HTTP (defined above)
      // wherein we set "use_ssl" to true.
      // *******************************************************************************

      transport.instance_variable_set(:@client, my_http_client)
      transport.get

      if transport.code != "200"
        raise "ERROR:  @irus_server_address: " + @irus_server_address +
                     " set_event_datestamp: " + params[:date_stamp] +
                     " set_client_ip_address: " + params[:client_ip_address] +
                     " user_agent: " + params[:user_agent] +
                     " set_oai_identifier: " + params[:item_oai_identifier] +
                     " set_file_url: " + params[:file_url] +
                     " set_http_referer: " + params[:http_referer] +
                     " set_source_repository: " + params[:source_repository] +
                     " transport.code: " + transport.code +
                     " transport.response: " + transport.response
      end


This explains the issues we've been having communicating with https:// JISC addresses both past and present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions