Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Unified Diff: net/test/embedded_test_server/http_response.h

Issue 1421903008: Revert of SSL in EmbeddedTestServer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/test/embedded_test_server/http_request.cc ('k') | net/test/embedded_test_server/http_response.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/embedded_test_server/http_response.h
diff --git a/net/test/embedded_test_server/http_response.h b/net/test/embedded_test_server/http_response.h
index cc4be86f76bc41450aa1f774c2785b2cd4d3bcb2..d4df75b5b85418960e39b54056b1562dfe4c4d39 100644
--- a/net/test/embedded_test_server/http_response.h
+++ b/net/test/embedded_test_server/http_response.h
@@ -5,10 +5,10 @@
#ifndef NET_TEST_EMBEDDED_TEST_SERVER_HTTP_RESPONSE_H_
#define NET_TEST_EMBEDDED_TEST_SERVER_HTTP_RESPONSE_H_
+#include <map>
#include <string>
#include "base/basictypes.h"
-#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/strings/string_split.h"
#include "net/http/http_status_code.h"
@@ -16,30 +16,19 @@
namespace net {
namespace test_server {
-// Callback called when the response is done being sent.
-using SendCompleteCallback = base::Callback<void(void)>;
-
-// Callback called when the response is ready to be sent that takes the
-// |response| that is being sent along with the callback |write_done| that is
-// called when the response has been fully written.
-using SendBytesCallback =
- base::Callback<void(const std::string& response,
- const SendCompleteCallback& write_done)>;
-
// Interface for HTTP response implementations.
class HttpResponse{
public:
virtual ~HttpResponse();
- // |send| will send the specified data to the network socket, and invoke
- // |write_done| when complete. When the entire response has been sent,
- // |done| must be called.
- virtual void SendResponse(const SendBytesCallback& send,
- const SendCompleteCallback& done) = 0;
+ // Returns raw contents to be written to the network socket
+ // in response. If you intend to make this a valid HTTP response,
+ // it should start with "HTTP/x.x" line, followed by response headers.
+ virtual std::string ToResponseString() const = 0;
};
// This class is used to handle basic HTTP responses with commonly used
-// response headers such as "Content-Type". Sends the response immediately.
+// response headers such as "Content-Type".
class BasicHttpResponse : public HttpResponse {
public:
BasicHttpResponse();
@@ -65,10 +54,7 @@
}
// Generates and returns a http response string.
- std::string ToResponseString() const;
-
- void SendResponse(const SendBytesCallback& send,
- const SendCompleteCallback& done) override;
+ std::string ToResponseString() const override;
private:
HttpStatusCode code_;
@@ -79,23 +65,6 @@
DISALLOW_COPY_AND_ASSIGN(BasicHttpResponse);
};
-class RawHttpResponse : public HttpResponse {
- public:
- RawHttpResponse(const std::string& headers, const std::string& contents);
- ~RawHttpResponse() override;
-
- void SendResponse(const SendBytesCallback& send,
- const SendCompleteCallback& done) override;
-
- void AddHeader(const std::string& key_value_pair);
-
- private:
- std::string headers_;
- const std::string contents_;
-
- DISALLOW_COPY_AND_ASSIGN(RawHttpResponse);
-};
-
} // namespace test_server
} // namespace net
« no previous file with comments | « net/test/embedded_test_server/http_request.cc ('k') | net/test/embedded_test_server/http_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698