From 4a944da69794f2bfcedc034bbc2b82976a071174 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Thu, 10 Sep 2020 19:42:43 +0800 Subject: [PATCH] Fix HttpProxySocket early data return value --- src/net/tools/naive/http_proxy_socket.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/net/tools/naive/http_proxy_socket.cc b/src/net/tools/naive/http_proxy_socket.cc index c29c400815..af91975f7e 100644 --- a/src/net/tools/naive/http_proxy_socket.cc +++ b/src/net/tools/naive/http_proxy_socket.cc @@ -148,16 +148,17 @@ int HttpProxySocket::Read(IOBuffer* buf, DCHECK(callback); if (!buffer_.empty()) { + was_ever_used_ = true; int data_len = buffer_.size(); if (data_len <= buf_len) { std::memcpy(buf->data(), buffer_.data(), data_len); buffer_.clear(); + return data_len; } else { std::memcpy(buf->data(), buffer_.data(), buf_len); buffer_ = buffer_.substr(buf_len); + return buf_len; } - was_ever_used_ = true; - return OK; } int rv = transport_->Read(