CPPSERV


Home Projects Jobs Clientele Contact

cppserv


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add reset() test for headers



From: Sergey Jukov <sergey@total-knowledge.com>

---
 ChangeLog       |    3 +++
 reset/reset.cpp |    4 +++-
 reset/reset.h   |    2 ++
 3 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b306a23..cde6de9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Sergey Jukov <sergey@total-knowledge.com>            Tue, 19 Sep 2006 15:50:00 -0800
+- Add testing reset() for headers
+
 Sergey Jukov <sergey@total-knowledge.com>            Tue, 19 Sep 2006 13:00:00 -0800
 - Add reset servlet test scripts
 
diff --git a/reset/reset.cpp b/reset/reset.cpp
index 81361e4..baab7c0 100644
--- a/reset/reset.cpp
+++ b/reset/reset.cpp
@@ -29,12 +29,14 @@ void ResetServlet::service(servlet::Http
 	servlet::Cookie cookie("TestResetCookie","bla-bla");
 	cookie.setMaxAge(3600);
 	resp.addCookie(cookie);
+	long seconds = time(NULL) + 3600;
+	resp.setDateHeader("expires", seconds);
 	if(reset!="false") {
 		resp.reset();
 	}
 	renderHeader(out);
 	if(it==cookies->end()) {
-		out<<"TestResetCookie is not set because of work of reset().<br>";
+		out<<"TestResetCookie and Expires response header are not set because of work of reset().<br>";
 		out<<"<a href=\""<<req.getRequestURI()<<"?reset=false\">Turn off reset</a>\n";
 	} else {
 		out<<"Reset is turned off.<br>";
diff --git a/reset/reset.h b/reset/reset.h
index 54ba129..6a8b299 100644
--- a/reset/reset.h
+++ b/reset/reset.h
@@ -29,6 +29,8 @@ #include <iostream>
 This servlet demonstrates work of reset() function. Cookie TestResetCookie
 will be set only if reset() is turned off. To start testing over, remove the
 cookie from your browser manually.
+Response header "expire" will be set to one hour greater than "modified" only
+if reset() is turned off.
 
 @author Ilya A. Volynets-Evenbakh
 */
-- 
1.4.2


Authoright © Total Knowledge: 2001-2008