replaceheader2.cc (506B)
1 #include "httpbuffer" 2 3 void Httpbuffer::replaceheader(string const &var, string const &val) { 4 PROFILE("Httpbuffer::replacehader(string,string)"); 5 6 if (!headersreceived()) 7 return; 8 9 debugmsg("Attempting to replace header " << var << " with " << val << '\n'); 10 11 unsigned off = findheader(var); 12 debugmsg("Header [" << var << "] occurs at position " << off << '\n'); 13 if (off) { 14 unsigned nl = charfind('\n', off); 15 if (nl) 16 removeat(off, nl - off + 1); 17 setheader(var, val); 18 } 19 }