Update of /cvsroot/mod-c/ehtml/samples
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2036/samples
Modified Files:
02session.cpp
Log Message:
* Bugfix: session variable "count" has to be a string.
* Bugfix: the session has to be released upon request termination.
Index: 02session.cpp
===================================================================
RCS file: /cvsroot/mod-c/ehtml/samples/02session.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** 02session.cpp 8 Sep 2006 14:28:17 -0000 1.1
--- 02session.cpp 12 Sep 2006 00:21:09 -0000 1.2
***************
*** 80,86 ****
} else {
cnt = atoi((*session)[COUNT].c_str());
! (*session)[COUNT] = cnt + 1;
}
lblCount.SetText("count = " + (*session)[COUNT]);
}
--- 80,93 ----
} else {
cnt = atoi((*session)[COUNT].c_str());
! ++cnt;
! char scnt[12];
! sprintf(scnt, "%lu", cnt);
! (*session)[COUNT] = scnt;
}
lblCount.SetText("count = " + (*session)[COUNT]);
+ printf("session id=%s\n", session->ID().hex().c_str());
+ GetResponse()->SetCookie(Session::SessionIDName(),
+ session->ID().hex());
+
}
***************
*** 90,93 ****
--- 97,101 ----
virtual int DoFinishStage() {
if (session && driver) {
+ printf("session id=%s\n", session->ID().hex().c_str());
if (!driver->Save(session)) {
ap_log_error(APLOG_MARK, LOG_ERR, 0,
***************
*** 97,100 ****
--- 105,119 ----
strerror(errno));
}
+
+ if (!driver->Release(session)) {
+ ap_log_error(APLOG_MARK, LOG_ERR, 0,
+ Request->GetRequestContext()->r->server,
+ "Error releasing session (hex=%s): %s",
+ session->ID().hex().c_str(),
+ strerror(errno));
+ }
+
+ //@todo TODO: MUST USE CONFIGURATION DIRECTIVE TO SEE WHICH ENCODING
+ //IS TO BE USED.
if (!driver->Disconnect()) {
ap_log_error(APLOG_MARK, LOG_ERR, 0,
|