Home » U++ Library support » U++ MT-multithreading and servers » [Bug] Httprequest - consecutive requests contain parts of previous requests
Re: [Bug] Httprequest - consecutive requests contain parts of previous requests [message #44605 is a reply to message #44585] |
Fri, 17 April 2015 10:11 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
Zbych wrote on Tue, 07 April 2015 10:44Hi,
I've just found ClearPost() - it clears all multipart and postdata variables, but content header must be cleared separately.
Working example:
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_FILE | LOG_CERR | LOG_TIMESTAMP);
HttpRequest hr("http://posttestserver.com/post.php");
hr.Trace();
hr.KeepAlive();
hr.ContentType(Null).ClearPost().New();
hr.Part("field1", "Lorem ipsum dolor sit amet, consectetur adipiscing elit");
hr.Part("field2", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua");
RLOG(hr.Execute());
hr.ContentType(Null).ClearPost().New();
hr.Post("field1", "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat");
RLOG(hr.Execute());
hr.ContentType(Null).ClearPost().New();
hr.Part("field1", "Lorem ipsum dolor sit amet, consectetur adipiscing elit");
hr.Part("field2", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua");
RLOG(hr.Execute());
}
Well, it really looks like behaviour is consistent with New documentation ("it does not change any existing settings").
It makes some sense, as in certain situations you want to retry existing request...
Perhaps the right solution would be to add "NewRequest", that resets data and keeps connection?
|
|
|
Goto Forum:
Current Time: Tue Jun 04 18:08:37 CEST 2024
Total time taken to generate the page: 0.02087 seconds
|