crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs | LICENSE

cookievalue.cc (552B)


      1 #include "httpbuffer"
      2 
      3 string Httpbuffer::cookievalue (string c) {
      4     PROFILE("Httpheader::cookievalue");
      5     
      6     string cval = headerval ("Cookie");
      7     string match = c;
      8     if (match[match.size() - 1] != '=')
      9 	match += '=';
     10     string ret = "";
     11     size_t pos = cval.find(match);
     12     if (pos != string::npos) {
     13 	pos += match.size();
     14 	for (char ch = cval[pos];
     15 	     pos < cval.size() && ch != ';' && ch != ',' && ch;
     16 	     ch = cval[++pos]) {
     17 	    ret += ch;
     18 	}
     19     }
     20     msg("Cookie value '" << c << "' : '" << ret << "'\n");
     21     return (ret);
     22 }