From dde2e18c0a70ddef913a3ad1160918a67fb235b1 Mon Sep 17 00:00:00 2001 From: Coren Date: Tue, 29 Sep 2015 12:56:28 +0200 Subject: [PATCH] Add uri called to debug output, and try to keep Session Cookie if one is provided --- lib/oai/client.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/oai/client.rb b/lib/oai/client.rb index a23316a..2b5b9d5 100644 --- a/lib/oai/client.rb +++ b/lib/oai/client.rb @@ -205,7 +205,7 @@ def sanitize_xml(xml) # remove default namespace for oai-pmh since libxml # isn't able to use our xpaths to get at them # if you know a way around thins please let me know - xml = xml.gsub( + xml.gsub!( /xmlns=\"http:\/\/www.openarchives.org\/OAI\/.\..\/\"/, '') end xml @@ -216,6 +216,7 @@ def sanitize_xml(xml) def do_request(verb, opts = nil) # fire off the request and return appropriate DOM object uri = build_uri(verb, opts) + debug(uri) return load_document(get(uri)) end @@ -270,7 +271,8 @@ def get(uri) req.url uri req.headers.merge! @headers end - + # Keep cookie session. Needed for old & buggy OAI-PMH provider + @headers['Cookie'] ||= response['set-cookie'] response.body end