From: Gonzalo A. <ga...@us...> - 2006-10-18 12:51:16
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24852/src Modified Files: Request.cpp Log Message: * Each cookie is stored in a separate header entry. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Request.cpp 12 Oct 2006 21:10:36 -0000 1.13 --- Request.cpp 18 Oct 2006 12:51:12 -0000 1.14 *************** *** 171,175 **** Debug("cmp %s =? %s", name.c_str(), (*i)->Value); if (!strncmp((*i)->Value, s.c_str(), s.length())) { ! Debug("got it! (%s)", (*i)->Value + name.length()+1); cookies_returned.push_front(string((*i)->Value + name.length()+1)); return &*cookies_returned.begin(); --- 171,175 ---- Debug("cmp %s =? %s", name.c_str(), (*i)->Value); if (!strncmp((*i)->Value, s.c_str(), s.length())) { ! Debug("found it! (%s)", (*i)->Value + name.length()+1); cookies_returned.push_front(string((*i)->Value + name.length()+1)); return &*cookies_returned.begin(); *************** *** 179,182 **** --- 179,201 ---- } + void Request::ProcessCookieHeader(const char* value) { + const char* s = skip_ws(value); + while (*s) { + if (*s == '$') { + // Cookie names starting with '$' are + // considered reserved and ignored. + s = skip_ws(skip_word(s)); + continue; + } + const char* end = s; + while (!isspace(*end) && *end != ';' && *end) ++end; + string Value(s, end-s); + HeaderCookies.push_back(new HeaderEntry("Cookie", Value.c_str())); + s = end; + if (*s) ++s; + s = skip_ws(s); + } + } + void Request::ParseHeader() { *************** *** 213,218 **** // Cookie? if ( strncmp( "kie", _tmp + 1, 3 ) == 0 ) ! // We have a cookie ! HeaderCookies.push_back( new HeaderEntry(tmp->key, tmp->val)); } // Is it Content-Length --- 232,237 ---- // Cookie? if ( strncmp( "kie", _tmp + 1, 3 ) == 0 ) ! // We have possibly, more than one cookie ! ProcessCookieHeader(tmp->val); } // Is it Content-Length |