From 6f35eb68c0b45aa64da442022cda82b7df9194c4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 29 Dec 2016 06:43:49 +0000 Subject: avoid pointless capture in regexp We do not emit any sort of message on successful 2XX responses, so there's no need to save the actual response after writing. --- lib/mogilefs/new_file/common.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mogilefs/new_file/common.rb b/lib/mogilefs/new_file/common.rb index c102901..44eee69 100644 --- a/lib/mogilefs/new_file/common.rb +++ b/lib/mogilefs/new_file/common.rb @@ -23,7 +23,7 @@ module MogileFS::NewFile::Common start_time = @opts[:start_time] and tout -= MogileFS.now - start_time set_socket_options(sock) case line = sock.timed_read(23, "", tout > 0.0 ? tout : 0) - when %r{^HTTP/\d\.\d\s+(2\d\d)\s} # success! + when %r{^HTTP/\d\.\d\s+(?:2\d\d)\s} # success! when nil raise EmptyResponseError, 'Unable to read response line from server' when %r{^HTTP/\d\.\d\s+(\d+)} -- cgit v1.2.3-24-ge0c7