mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-29 19:53:44 -06:00 
			
		
		
		
	Wifi Duet upload: Improved some string copying.
This commit is contained in:
		
							parent
							
								
									70e44c3e8e
								
							
						
					
					
						commit
						acbf25681a
					
				
					 2 changed files with 6 additions and 6 deletions
				
			
		|  | @ -139,7 +139,7 @@ struct Http::priv | |||
| 	void set_timeout_connect(long timeout); | ||||
| 	void form_add_file(const char *name, const fs::path &path, const char* filename); | ||||
| 	void set_post_body(const fs::path &path); | ||||
| 	void set_post_body(const std::string body); | ||||
| 	void set_post_body(const std::string &body); | ||||
| 	void set_put_body(const fs::path &path); | ||||
| 
 | ||||
| 	std::string curl_error(CURLcode curlcode); | ||||
|  | @ -155,7 +155,6 @@ Http::priv::priv(const std::string &url) | |||
| 	, error_buffer(CURL_ERROR_SIZE + 1, '\0') | ||||
| 	, limit(0) | ||||
| 	, cancel(false) | ||||
| 	, putFile(nullptr) | ||||
| { | ||||
|     Http::tls_global_init(); | ||||
| 
 | ||||
|  | @ -281,14 +280,15 @@ void Http::priv::form_add_file(const char *name, const fs::path &path, const cha | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| //FIXME may throw! Is the caller aware of it?
 | ||||
| void Http::priv::set_post_body(const fs::path &path) | ||||
| { | ||||
| 	std::ifstream file(path.string()); | ||||
| 	std::string file_content { std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>() }; | ||||
| 	postfields = file_content; | ||||
| 	postfields = std::move(file_content); | ||||
| } | ||||
| 
 | ||||
| void Http::priv::set_post_body(const std::string body) | ||||
| void Http::priv::set_post_body(const std::string &body) | ||||
| { | ||||
| 	postfields = body; | ||||
| } | ||||
|  | @ -488,7 +488,7 @@ Http& Http::set_post_body(const fs::path &path) | |||
| 	return *this; | ||||
| } | ||||
| 
 | ||||
| Http& Http::set_post_body(const std::string body) | ||||
| Http& Http::set_post_body(const std::string &body) | ||||
| { | ||||
| 	if (p) { p->set_post_body(body); } | ||||
| 	return *this; | ||||
|  |  | |||
|  | @ -86,7 +86,7 @@ public: | |||
| 	// Set the POST request body.
 | ||||
| 	// The data is used verbatim, it is not additionally encoded in any way.
 | ||||
| 	// This can be used for hosts which do not support multipart requests.
 | ||||
| 	Http& set_post_body(const std::string body); | ||||
| 	Http& set_post_body(const std::string &body); | ||||
| 
 | ||||
| 	// Set the file contents as a PUT request body.
 | ||||
| 	// The data is used verbatim, it is not additionally encoded in any way.
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vojtech Bubnik
						Vojtech Bubnik