#include "squid.h"
#include "Debug.h"
#include "http/one/Parser.h"
+#include "HttpHdrCc.h"
#include "HttpHeaderTools.h"
#include "HttpMsg.h"
#include "MemBuf.h"
assert(!body_pipe);
}
+void
+HttpMsg::putCc(const HttpHdrCc *otherCc)
+{
+ // get rid of the old CC, if any
+ if (cache_control) {
+ delete cache_control;
+ cache_control = nullptr;
+ if (!otherCc)
+ header.delById(HDR_CACHE_CONTROL);
+ // else it will be deleted inside putCc() below
+ }
+
+ // add new CC, if any
+ if (otherCc) {
+ cache_control = new HttpHdrCc(*otherCc);
+ header.putCc(cache_control);
+ }
+}
+
HttpMsgParseState &operator++ (HttpMsgParseState &aState)
{
int tmp = (int)aState;
uint32_t sources; ///< The message sources
+ /// copies Cache-Control header to this message
+ void putCc(const HttpHdrCc *otherCc);
+
// returns true and sets hdr_sz on success
// returns false and sets *error to zero when needs more data
// returns false and sets *error to a positive Http::StatusCode on error
rv->last_modified = last_modified;
rv->expires = expires;
rv->content_type = content_type;
- /* rv->cache_control */
/* rv->content_range */
/* rv->keep_alive */
rv->sline.set(Http::ProtocolVersion(), Http::scNotModified, NULL);
rv->header.addEntry(e->clone());
}
+ rv->putCc(cache_control);
+
/* rv->body */
return rv;
}