Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'gems/gitlab-http/lib/net_http/response_patch.rb')
-rw-r--r--gems/gitlab-http/lib/net_http/response_patch.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/gems/gitlab-http/lib/net_http/response_patch.rb b/gems/gitlab-http/lib/net_http/response_patch.rb
index e5477a31318..303d629b32e 100644
--- a/gems/gitlab-http/lib/net_http/response_patch.rb
+++ b/gems/gitlab-http/lib/net_http/response_patch.rb
@@ -20,11 +20,12 @@ module Net
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
key = value = nil
while true
- line = if sock.is_a?(Gitlab::HTTP_V2::BufferedIo)
- sock.readuntil("\n", true, start_time)
- else
- sock.readuntil("\n", true)
- end
+ uses_buffered_io = sock.is_a?(Gitlab::HTTP_V2::BufferedIo)
+
+ # TODO: Gitlab::BufferedIo is temporarily used for an easy migration.
+ uses_buffered_io ||= sock.is_a?(Gitlab::BufferedIo) if defined?(Gitlab::BufferedIo)
+
+ line = uses_buffered_io ? sock.readuntil("\n", true, start_time) : sock.readuntil("\n", true)
line = line.sub(/\s{0,10}\z/, '')
break if line.empty?
if line[0] == ?\s or line[0] == ?\t and value