Chromium Code Reviews| Index: net/test/embedded_test_server/http_connection.cc |
| diff --git a/net/test/embedded_test_server/http_connection.cc b/net/test/embedded_test_server/http_connection.cc |
| index 83d2e9f4e562ec5bfaf579fae8bcfc75832256f0..6ac2d2bacc0612ad85795b200d823bb83d1e43ef 100644 |
| --- a/net/test/embedded_test_server/http_connection.cc |
| +++ b/net/test/embedded_test_server/http_connection.cc |
| @@ -6,7 +6,6 @@ |
| #include "net/base/net_errors.h" |
| #include "net/socket/stream_socket.h" |
| -#include "net/test/embedded_test_server/http_response.h" |
| namespace net { |
| namespace test_server { |
| @@ -20,9 +19,8 @@ HttpConnection::HttpConnection(scoped_ptr<StreamSocket> socket, |
| HttpConnection::~HttpConnection() { |
| } |
| -void HttpConnection::SendResponse(scoped_ptr<HttpResponse> response, |
| - const base::Closure& callback) { |
| - const std::string response_string = response->ToResponseString(); |
| +void HttpConnection::SendResponse(std::string response_string, |
| + SendCompleteCallback callback) { |
| if (response_string.length() > 0) { |
| scoped_refptr<DrainableIOBuffer> write_buf(new DrainableIOBuffer( |
| new StringIOBuffer(response_string), response_string.length())); |
| @@ -42,6 +40,8 @@ void HttpConnection::SendInternal(const base::Closure& callback, |
| if (rv == ERR_IO_PENDING) |
| return; |
| + if (rv < 0) |
| + break; |
| buf->DidConsume(rv); |
| } |
| @@ -53,6 +53,10 @@ void HttpConnection::SendInternal(const base::Closure& callback, |
| void HttpConnection::OnSendInternalDone(const base::Closure& callback, |
| scoped_refptr<DrainableIOBuffer> buf, |
| int rv) { |
| + if (rv < 0) { |
| + callback.Run(); |
| + return; |
|
mmenke
2015/10/15 20:16:15
Hrm...the fact that we didn't have these before is
svaldez
2015/10/15 21:04:32
Should this be an ETS test, or should we have sepa
mmenke
2015/10/15 21:13:54
I'm thinking an ETS test.
|
| + } |
| buf->DidConsume(rv); |
| SendInternal(callback, buf); |
| } |