| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // // Use of this source code is governed by a BSD-style license that can be | 2 // // Use of this source code is governed by a BSD-style license that can be |
| 3 // // found in the LICENSE file. | 3 // // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_ | 5 #ifndef NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_ |
| 6 #define NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_ | 6 #define NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "net/quic/core/quic_packets.h" | 11 #include "net/quic/core/quic_packets.h" |
| 12 #include "net/quic/core/quic_spdy_stream.h" | 12 #include "net/quic/core/quic_spdy_stream.h" |
| 13 #include "net/quic/platform/api/quic_string_piece.h" |
| 13 #include "net/spdy/spdy_framer.h" | 14 #include "net/spdy/spdy_framer.h" |
| 14 #include "net/tools/quic/quic_http_response_cache.h" | 15 #include "net/tools/quic/quic_http_response_cache.h" |
| 15 #include "net/tools/quic/quic_spdy_server_stream_base.h" | 16 #include "net/tools/quic/quic_spdy_server_stream_base.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 namespace test { | 20 namespace test { |
| 20 class QuicSimpleServerStreamPeer; | 21 class QuicSimpleServerStreamPeer; |
| 21 } // namespace test | 22 } // namespace test |
| 22 | 23 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 58 |
| 58 // Sends a basic 500 response using SendHeaders for the headers and WriteData | 59 // Sends a basic 500 response using SendHeaders for the headers and WriteData |
| 59 // for the body. | 60 // for the body. |
| 60 virtual void SendErrorResponse(); | 61 virtual void SendErrorResponse(); |
| 61 | 62 |
| 62 // Sends a basic 404 response using SendHeaders for the headers and WriteData | 63 // Sends a basic 404 response using SendHeaders for the headers and WriteData |
| 63 // for the body. | 64 // for the body. |
| 64 void SendNotFoundResponse(); | 65 void SendNotFoundResponse(); |
| 65 | 66 |
| 66 void SendHeadersAndBody(SpdyHeaderBlock response_headers, | 67 void SendHeadersAndBody(SpdyHeaderBlock response_headers, |
| 67 base::StringPiece body); | 68 QuicStringPiece body); |
| 68 void SendHeadersAndBodyAndTrailers(SpdyHeaderBlock response_headers, | 69 void SendHeadersAndBodyAndTrailers(SpdyHeaderBlock response_headers, |
| 69 base::StringPiece body, | 70 QuicStringPiece body, |
| 70 SpdyHeaderBlock response_trailers); | 71 SpdyHeaderBlock response_trailers); |
| 71 | 72 |
| 72 SpdyHeaderBlock* request_headers() { return &request_headers_; } | 73 SpdyHeaderBlock* request_headers() { return &request_headers_; } |
| 73 | 74 |
| 74 const std::string& body() { return body_; } | 75 const std::string& body() { return body_; } |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 friend class test::QuicSimpleServerStreamPeer; | 78 friend class test::QuicSimpleServerStreamPeer; |
| 78 | 79 |
| 79 // The parsed headers received from the client. | 80 // The parsed headers received from the client. |
| 80 SpdyHeaderBlock request_headers_; | 81 SpdyHeaderBlock request_headers_; |
| 81 int64_t content_length_; | 82 int64_t content_length_; |
| 82 std::string body_; | 83 std::string body_; |
| 83 | 84 |
| 84 QuicHttpResponseCache* response_cache_; // Not owned. | 85 QuicHttpResponseCache* response_cache_; // Not owned. |
| 85 | 86 |
| 86 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServerStream); | 87 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServerStream); |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace net | 90 } // namespace net |
| 90 | 91 |
| 91 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_ | 92 #endif // NET_TOOLS_QUIC_QUIC_SIMPLE_SERVER_STREAM_H_ |
| OLD | NEW |