Differences From:
File
src/cgi.c
part of check-in
[dcc48662f8]
- Better error messages when trying to run "fossil ui" with an invalid
or unaccessible repository.
by
drh on
2008-06-08 15:45:36.
[view]
To:
File
src/cgi.c
part of check-in
[070e63db33]
- Merge old tagview branch into this branch
by
eric on
2008-08-17 20:53:20.
Also file
src/cgi.c
part of check-in
[8745d0d579]
- Merge tagview branch into mainline
by
eric on
2008-09-06 13:29:29.
[view]
@@ -201,11 +201,13 @@
){
if( zPath==0 ) zPath = g.zTop;
if( lifetime>0 ){
lifetime += (int)time(0);
+ char * zDate = cgi_rfc822_datestamp(lifetime);
blob_appendf(&extraHeader,
- "Set-Cookie: %s=%t; Path=%s; expires=%s; Version=1\r\n",
- zName, zValue, zPath, cgi_rfc822_datestamp(lifetime));
+ "Set-Cookie: %s=%t; Path=%s; expires=%z; Version=1\r\n",
+ zName, zValue, zPath, zDate);
+ if( zDate[0] ) free( zDate );
}else{
blob_appendf(&extraHeader,
"Set-Cookie: %s=%t; Path=%s; Version=1\r\n",
zName, zValue, zPath);
@@ -287,9 +289,11 @@
#endif
if( g.fullHttpReply ){
fprintf(g.httpOut, "HTTP/1.0 %d %s\r\n", iReplyStatus, zReplyStatus);
- fprintf(g.httpOut, "Date: %s\r\n", cgi_rfc822_datestamp(time(0)));
+ char * zDate = cgi_rfc822_datestamp(time(0));
+ fprintf(g.httpOut, "Date: %s\r\n", zDate );
+ if( zDate[0] ) free( zDate );
fprintf(g.httpOut, "Connection: close\r\n");
}else{
fprintf(g.httpOut, "Status: %d %s\r\n", iReplyStatus, zReplyStatus);
}
@@ -308,9 +312,11 @@
** header set to a reasonable period (default: one week).
*/
/*time_t expires = time(0) + atoi(db_config("constant_expires","604800"));*/
time_t expires = time(0) + 604800;
- fprintf(g.httpOut, "Expires: %s\r\n", cgi_rfc822_datestamp(expires));
+ char * zDate = cgi_rfc822_datestamp(expires);
+ fprintf(g.httpOut, "Expires: %s\r\n", zDate );
+ if( zDate[0] ) free( zDate );
}
/* Content intended for logged in users should only be cached in
** the browser, not some shared location.
@@ -1268,8 +1274,10 @@
/*
** Returns an RFC822-formatted time string suitable for HTTP headers, among
** other things.
** Returned timezone is always GMT as required by HTTP/1.1 specification.
+** The returned string is allocated with malloc() and must be freed
+** with free().
**
** See http://www.faqs.org/rfcs/rfc822.html, section 5
** and http://www.faqs.org/rfcs/rfc2616.html, section 3.3.
*/