U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ MT-multithreading and servers » HttpRequest, Content-ID header in Part method
Re: HttpRequest, Content-ID header in Part method [message #44578 is a reply to message #44564] Sat, 04 April 2015 09:42 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Zbych wrote on Tue, 31 March 2015 21:29
Hi Sergey,

You are right. Probably we need more generic Part method with headers defined by a user. Maybe something like this:

HttpRequest& HttpRequest::Part(const Vector<String>& header, const String& data,
                               const char *content_type)
{
	if(IsNull(multipart)) {
		POST();
		multipart = AsString(Uuid::Create());
		if (content_type && *content_type)
			ContentType(String(content_type) + "; boundary=" + multipart);
		else ContentType("multipart/form-data; boundary=" + multipart);
	}
	postdata << "--" << multipart << "\r\n";
	for (int i = 0; i < header.GetCount(); i++){
		postdata << header[i] << "\r\n";
	}

	postdata << "\r\n" << data << "\r\n";
	return *this;
}



I agree that this is missing. However, I would rather add "headers" last parameter as either const String& or const char *, which would simple would be put to postdata before the actual data. That way is more alike to Headers method. Do you agree?

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to add statistics feature on SkyLark aplication?
Next Topic: [Bug] Httprequest - consecutive requests contain parts of previous requests
Goto Forum:
  


Current Time: Sun Apr 26 05:46:41 GMT+2 2026

Total time taken to generate the page: 0.00515 seconds