Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Zbych wrote on Tue, 07 April 2015 10:44
Hi,

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?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: HttpRequest, Content-ID header in Part method
Next Topic: How to just Post data ?
Goto Forum:
  


Current Time: Tue Jun 04 18:08:37 CEST 2024

Total time taken to generate the page: 0.02087 seconds