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 #44564 is a reply to message #44563] |
Tue, 31 March 2015 21:29   |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
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;
}
[Updated on: Thu, 02 April 2015 10:23] Report message to a moderator
|
|
|
|
|
Re: HttpRequest, Content-ID header in Part method [message #44586 is a reply to message #44578] |
Tue, 07 April 2015 11:02  |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
mirek wrote on Sat, 04 April 2015 09:42I 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
I don't think it is a good solution. Beside headers in each attachment, I would like to be able to modify content-type header, which is hard-coded in Part function:
ContentType("multipart/form-data; boundary=" + multipart);
It would be better to have another "low level" Part function (Part0 or PartLL) with content-type and attachment headers configurable.
And of course "old" Part function should use this new "low level" Part.
[Updated on: Tue, 07 April 2015 16:19] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 28 14:18:02 CEST 2025
Total time taken to generate the page: 0.04357 seconds
|