OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void SetBodyStream(scoped_ptr<HTTPBodyStream> stream); | 67 void SetBodyStream(scoped_ptr<HTTPBodyStream> stream); |
68 | 68 |
69 //! \brief Sets the timeout for the HTTP request. The default is 15 seconds. | 69 //! \brief Sets the timeout for the HTTP request. The default is 15 seconds. |
70 //! | 70 //! |
71 //! \param[in] timeout The request timeout, in seconds. | 71 //! \param[in] timeout The request timeout, in seconds. |
72 void SetTimeout(double timeout); | 72 void SetTimeout(double timeout); |
73 | 73 |
74 //! \brief Performs the HTTP request with the configured parameters and waits | 74 //! \brief Performs the HTTP request with the configured parameters and waits |
75 //! for the execution to complete. | 75 //! for the execution to complete. |
76 //! | 76 //! |
| 77 //! \param[out] response On success, this will be set to the HTTP response |
| 78 //! body. This parameter is optional and may be set to `nullptr` if the |
| 79 //! response body is not required. |
| 80 //! |
77 //! \return Whether or not the request was successful, defined as returning | 81 //! \return Whether or not the request was successful, defined as returning |
78 //! a HTTP status 200 (OK) code. | 82 //! a HTTP status 200 (OK) code. |
79 virtual bool ExecuteSynchronously() = 0; | 83 virtual bool ExecuteSynchronously(std::string* response_body) = 0; |
80 | 84 |
81 protected: | 85 protected: |
82 HTTPTransport(); | 86 HTTPTransport(); |
83 | 87 |
84 const std::string& url() const { return url_; } | 88 const std::string& url() const { return url_; } |
85 const std::string& method() const { return method_; } | 89 const std::string& method() const { return method_; } |
86 const HTTPHeaders& headers() const { return headers_; } | 90 const HTTPHeaders& headers() const { return headers_; } |
87 HTTPBodyStream* body_stream() const { return body_stream_.get(); } | 91 HTTPBodyStream* body_stream() const { return body_stream_.get(); } |
88 double timeout() const { return timeout_; } | 92 double timeout() const { return timeout_; } |
89 | 93 |
90 private: | 94 private: |
91 std::string url_; | 95 std::string url_; |
92 std::string method_; | 96 std::string method_; |
93 HTTPHeaders headers_; | 97 HTTPHeaders headers_; |
94 scoped_ptr<HTTPBodyStream> body_stream_; | 98 scoped_ptr<HTTPBodyStream> body_stream_; |
95 double timeout_; | 99 double timeout_; |
96 | 100 |
97 DISALLOW_COPY_AND_ASSIGN(HTTPTransport); | 101 DISALLOW_COPY_AND_ASSIGN(HTTPTransport); |
98 }; | 102 }; |
99 | 103 |
100 } // namespace crashpad | 104 } // namespace crashpad |
101 | 105 |
102 #endif // CRASHPAD_UTIL_NET_HTTP_TRANSPORT_H_ | 106 #endif // CRASHPAD_UTIL_NET_HTTP_TRANSPORT_H_ |
OLD | NEW |