From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 0F18D2092F for ; Thu, 29 Dec 2016 07:42:24 +0000 (UTC) From: Eric Wong To: mogilefs-client-public@bogomips.org Subject: [PATCH 1/3] avoid pointless capture in regexp Date: Thu, 29 Dec 2016 07:42:13 +0000 Message-Id: <20161229074215.12425-2-e@80x24.org> In-Reply-To: <20161229074215.12425-1-e@80x24.org> References: <20161229074215.12425-1-e@80x24.org> List-Id: 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 @@ def read_response(sock) 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+)} -- EW