62
62
static http_hdr_type Denied304HeadersArr[] = {
63
63
// hop-by-hop headers
64
64
HDR_CONNECTION, HDR_KEEP_ALIVE, HDR_PROXY_AUTHENTICATE, HDR_PROXY_AUTHORIZATION,
65
HDR_TE, HDR_TRAILERS, HDR_TRANSFER_ENCODING, HDR_UPGRADE,
65
HDR_TE, HDR_TRAILER, HDR_TRANSFER_ENCODING, HDR_UPGRADE,
67
67
HDR_ALLOW, HDR_CONTENT_ENCODING, HDR_CONTENT_LANGUAGE, HDR_CONTENT_LENGTH,
68
68
HDR_CONTENT_MD5, HDR_CONTENT_RANGE, HDR_CONTENT_TYPE, HDR_LAST_MODIFIED
186
186
/* rv->content_range */
187
187
/* rv->keep_alive */
188
188
HttpVersion ver(1,0);
189
httpStatusLineSet(&rv->sline, ver, HTTP_NOT_MODIFIED, "");
189
httpStatusLineSet(&rv->sline, ver, HTTP_NOT_MODIFIED, NULL);
191
191
for (t = 0; ImsEntries[t] != HDR_OTHER; ++t)
192
192
if ((e = header.findEntry(ImsEntries[t])))
540
540
expectBody = true;
542
542
if (expectBody) {
543
if (header.hasListMember(HDR_TRANSFER_ENCODING, "chunked", ','))
543
if (header.chunked())
545
545
else if (content_length >= 0)
546
546
theSize = content_length;
589
589
bodySizeMax = -1;
591
591
ACLFilledChecklist ch(NULL, &request, NULL);
592
ch.src_addr = request.client_addr;
592
#if FOLLOW_X_FORWARDED_FOR
593
if (Config.onoff.acl_uses_indirect_client)
594
ch.src_addr = request.indirect_client_addr;
597
ch.src_addr = request.client_addr;
593
598
ch.my_addr = request.my_addr;
594
599
ch.reply = HTTPMSGLOCK(this); // XXX: this lock makes method non-const
595
600
for (acl_size_t *l = Config.ReplyBodySize; l; l = l -> next) {
629
634
keep_alive = aRep->keep_alive;
638
void HttpReply::removeStaleWarnings()
641
if (header.getList(HDR_WARNING, &warning)) {
642
const String newWarning = removeStaleWarningValues(warning);
643
if (warning.size() && warning.size() == newWarning.size())
644
return; // some warnings are there and none changed
645
header.delById(HDR_WARNING);
646
if (newWarning.size()) { // some warnings left
647
HttpHeaderEntry *const e =
648
new HttpHeaderEntry(HDR_WARNING, NULL, newWarning.termedBuf());
655
* Remove warning-values with warn-date different from Date value from
656
* a single header entry. Returns a string with all valid warning-values.
658
String HttpReply::removeStaleWarningValues(const String &value)
661
const char *item = 0;
664
while (strListGetItem(&value, ',', &item, &len, &pos)) {
666
// Does warning-value have warn-date (which contains quoted date)?
667
// We scan backwards, looking for two quoted strings.
668
// warning-value = warn-code SP warn-agent SP warn-text [SP warn-date]
669
const char *p = item + len - 1;
671
while (p >= item && xisspace(*p)) --p; // skip whitespace
673
// warning-value MUST end with quote
674
if (p >= item && *p == '"') {
675
const char *const warnDateEnd = p;
677
while (p >= item && *p != '"') --p; // find the next quote
679
const char *warnDateBeg = p + 1;
681
while (p >= item && xisspace(*p)) --p; // skip whitespace
683
if (p >= item && *p == '"' && warnDateBeg - p > 2) {
686
warnDate.append(warnDateBeg, warnDateEnd - warnDateBeg);
687
const time_t time = parse_rfc1123(warnDate.termedBuf());
688
keep = (time > 0 && time == date); // keep valid and matching date
694
newValue.append(", ");
695
newValue.append(item, len);