CPPSERV


Home Projects Jobs Clientele Contact

cppserv


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

[PATCH] More header handling fixes



This patch fixes addHeader and date function.
diff --git a/ChangeLog b/ChangeLog
index 029fdd5..e163a90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006.15.08        Sergey Jukov <sergey@total-knowledge>
+- Use correct format in set/addDateHeader
+- Use lower case name for headers in addHeader (similar
+  to setHeader fix)
+
 2006.14.08        Sergey Jukov <sergey@total-knowledge>
 - Fix setHeader() bug in HttpServletResponseImpl.cpp
 
diff --git a/src/container/HttpServletResponseImpl.cpp b/src/container/HttpServletResponseImpl.cpp
index b507372..f57ee09 100644
--- a/src/container/HttpServletResponseImpl.cpp
+++ b/src/container/HttpServletResponseImpl.cpp
@@ -142,7 +142,7 @@ void container::HttpServletResponseImpl:
 
 	std::string lname(name);
 	std::transform(lname.begin(),lname.end(),lname.begin(),util::ToLower());
-	headers.erase(headers.lower_bound(name),headers.upper_bound(name));
+	headers.erase(headers.lower_bound(lname),headers.upper_bound(lname));
 	headers.insert(util::nvpair(lname,value));
 }
 
@@ -304,7 +304,7 @@ void  HttpServletResponseImpl::setDateHe
 	struct tm out;
 	gmtime_r(&date, &out);
 	char str[32];
-	strftime(str, sizeof(str), "%a, %d %m %Y %H:%M:%S GMT", &out);
+	strftime(str, sizeof(str), "%a, %d %b %Y %H:%M:%S GMT", &out);
 	setHeader(name, str);
 }
 void  HttpServletResponseImpl::addDateHeader(const std::string& name, long date)
@@ -312,7 +312,7 @@ void  HttpServletResponseImpl::addDateHe
 	struct tm out;
 	gmtime_r(&date, &out);
 	char str[32];
-	strftime(str, sizeof(str), "%a, %d %m %Y %H:%M:%S GMT", &out);
+	strftime(str, sizeof(str), "%a, %d %b %Y %H:%M:%S GMT", &out);
 	addHeader(name, str);
 }
 void  HttpServletResponseImpl::setIntHeader(const std::string& name, int value)

Authoright © Total Knowledge: 2001-2008