lib/filbunke/client.rb in filbunke-1.11.9 vs lib/filbunke/client.rb in filbunke-1.12.0

- old
+ new

@@ -8,11 +8,10 @@ LAST_CHECKPOINT_ACTION = 'last_checkpoint' TOUCH_ACTION = 'touch' URL_KEY = 'url' FROM_CHECKPOINT_KEY = 'from_checkpoint' HASH_KEY = 'hash' - URI_UNSAFE_CHARACTERS = '/[^.:\/\w-]/' def initialize(repository, logger, callbacks = [], failed_request_log_file_name = nil) @repository = repository @logger = logger @@ -204,10 +203,11 @@ begin updates_http = Net::HTTP.new(@repository.host, @repository.port) updates_http.read_timeout = 300 # default is 60 seconds updates_http.start do |http| updates_path = "/#{UPDATES_ACTION}/#{@repository.name}?#{FROM_CHECKPOINT_KEY}=#{last_checkpoint}" + updates_path = "#{updates_path}&batch_size=#{@repository.batch_size}" if @repository.batch_size begin @logger.info "Fetching updated file list from #{updates_path}" request = Net::HTTP::Get.new(updates_path) response = http.request(request) if response.code.to_i == 200 @@ -222,18 +222,18 @@ end end rescue StandardError => e @logger.error "Unable to create HTTP connection to #{@repository.host}:#{@repository.port} (#{e.message})!" return {} - end + end end def update_http_file!(file, local_file_path) begin async_request = if @repository.user - Typhoeus::Request.new(URI.encode(file.url, URI_UNSAFE_CHARACTERS), :follow_location => true, :username => @repository.user, :password => @repository.pass) + Typhoeus::Request.new(URI.encode(file.url), :follow_location => true, :username => @repository.user, :password => @repository.pass) else - Typhoeus::Request.new(URI.encode(file.url, URI_UNSAFE_CHARACTERS), :follow_location => true) + Typhoeus::Request.new(URI.encode(file.url), :follow_location => true) end async_request.on_complete do |response| success = false begin success = response.code.to_i == 200