mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 23:21:54 +00:00 
			
		
		
		
	Merge branch 'http_request_no_copy' into integration
This commit is contained in:
		| @@ -169,7 +169,7 @@ class HttpRequestComponent : public Component { | |||||||
|  protected: |  protected: | ||||||
|   virtual std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, |   virtual std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, | ||||||
|                                                  const std::string &body, const std::list<Header> &request_headers, |                                                  const std::string &body, const std::list<Header> &request_headers, | ||||||
|                                                  std::set<std::string> collect_headers) = 0; |                                                  const std::set<std::string> &collect_headers) = 0; | ||||||
|   const char *useragent_{nullptr}; |   const char *useragent_{nullptr}; | ||||||
|   bool follow_redirects_{}; |   bool follow_redirects_{}; | ||||||
|   uint16_t redirect_limit_{}; |   uint16_t redirect_limit_{}; | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ static const char *const TAG = "http_request.arduino"; | |||||||
| std::shared_ptr<HttpContainer> HttpRequestArduino::perform(const std::string &url, const std::string &method, | std::shared_ptr<HttpContainer> HttpRequestArduino::perform(const std::string &url, const std::string &method, | ||||||
|                                                            const std::string &body, |                                                            const std::string &body, | ||||||
|                                                            const std::list<Header> &request_headers, |                                                            const std::list<Header> &request_headers, | ||||||
|                                                            std::set<std::string> collect_headers) { |                                                            const std::set<std::string> &collect_headers) { | ||||||
|   if (!network::is_connected()) { |   if (!network::is_connected()) { | ||||||
|     this->status_momentary_error("failed", 1000); |     this->status_momentary_error("failed", 1000); | ||||||
|     ESP_LOGW(TAG, "HTTP Request failed; Not connected to network"); |     ESP_LOGW(TAG, "HTTP Request failed; Not connected to network"); | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ class HttpRequestArduino : public HttpRequestComponent { | |||||||
|  protected: |  protected: | ||||||
|   std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body, |   std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body, | ||||||
|                                          const std::list<Header> &request_headers, |                                          const std::list<Header> &request_headers, | ||||||
|                                          std::set<std::string> collect_headers) override; |                                          const std::set<std::string> &collect_headers) override; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| }  // namespace http_request | }  // namespace http_request | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ static const char *const TAG = "http_request.host"; | |||||||
| std::shared_ptr<HttpContainer> HttpRequestHost::perform(const std::string &url, const std::string &method, | std::shared_ptr<HttpContainer> HttpRequestHost::perform(const std::string &url, const std::string &method, | ||||||
|                                                         const std::string &body, |                                                         const std::string &body, | ||||||
|                                                         const std::list<Header> &request_headers, |                                                         const std::list<Header> &request_headers, | ||||||
|                                                         std::set<std::string> response_headers) { |                                                         const std::set<std::string> &response_headers) { | ||||||
|   if (!network::is_connected()) { |   if (!network::is_connected()) { | ||||||
|     this->status_momentary_error("failed", 1000); |     this->status_momentary_error("failed", 1000); | ||||||
|     ESP_LOGW(TAG, "HTTP Request failed; Not connected to network"); |     ESP_LOGW(TAG, "HTTP Request failed; Not connected to network"); | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ class HttpRequestHost : public HttpRequestComponent { | |||||||
|  public: |  public: | ||||||
|   std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body, |   std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body, | ||||||
|                                          const std::list<Header> &request_headers, |                                          const std::list<Header> &request_headers, | ||||||
|                                          std::set<std::string> response_headers) override; |                                          const std::set<std::string> &response_headers) override; | ||||||
|   void set_ca_path(const char *ca_path) { this->ca_path_ = ca_path; } |   void set_ca_path(const char *ca_path) { this->ca_path_ = ca_path; } | ||||||
|  |  | ||||||
|  protected: |  protected: | ||||||
|   | |||||||
| @@ -55,7 +55,7 @@ esp_err_t HttpRequestIDF::http_event_handler(esp_http_client_event_t *evt) { | |||||||
| std::shared_ptr<HttpContainer> HttpRequestIDF::perform(const std::string &url, const std::string &method, | std::shared_ptr<HttpContainer> HttpRequestIDF::perform(const std::string &url, const std::string &method, | ||||||
|                                                        const std::string &body, |                                                        const std::string &body, | ||||||
|                                                        const std::list<Header> &request_headers, |                                                        const std::list<Header> &request_headers, | ||||||
|                                                        std::set<std::string> collect_headers) { |                                                        const std::set<std::string> &collect_headers) { | ||||||
|   if (!network::is_connected()) { |   if (!network::is_connected()) { | ||||||
|     this->status_momentary_error("failed", 1000); |     this->status_momentary_error("failed", 1000); | ||||||
|     ESP_LOGE(TAG, "HTTP Request failed; Not connected to network"); |     ESP_LOGE(TAG, "HTTP Request failed; Not connected to network"); | ||||||
|   | |||||||
| @@ -39,7 +39,7 @@ class HttpRequestIDF : public HttpRequestComponent { | |||||||
|  protected: |  protected: | ||||||
|   std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body, |   std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body, | ||||||
|                                          const std::list<Header> &request_headers, |                                          const std::list<Header> &request_headers, | ||||||
|                                          std::set<std::string> collect_headers) override; |                                          const std::set<std::string> &collect_headers) override; | ||||||
|   // if zero ESP-IDF will use DEFAULT_HTTP_BUF_SIZE |   // if zero ESP-IDF will use DEFAULT_HTTP_BUF_SIZE | ||||||
|   uint16_t buffer_size_rx_{}; |   uint16_t buffer_size_rx_{}; | ||||||
|   uint16_t buffer_size_tx_{}; |   uint16_t buffer_size_tx_{}; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user