~ubuntu-branches/ubuntu/oneiric/squid3/oneiric-security

« back to all changes in this revision

Viewing changes to src/HttpHeader.cc

  • Committer: Bazaar Package Importer
  • Author(s): Mahyuddin Susanto
  • Date: 2011-02-15 18:46:13 UTC
  • mfrom: (21.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110215184613-1u3dh5sz4i055flk
Tags: 3.1.10-1ubuntu1
* Merge from debian unstable. (LP: #719283)  Remaining changes:
  - debian/patches/18-fix-ftbfs-binutils-gold.dpatch: Add library linker into
    LIBS instead to LDFLAGS to fixing FTBFS binutils-gold.
* Drop Ubuntu configuration for ufw which landed in Debian and sync it: 
  - debian/squid3.ufw.profile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
    {"Content-Range", HDR_CONTENT_RANGE, ftPContRange},
93
93
    {"Content-Type", HDR_CONTENT_TYPE, ftStr},
94
94
    {"Cookie", HDR_COOKIE, ftStr},
 
95
    {"Cookie2", HDR_COOKIE2, ftStr},
95
96
    {"Date", HDR_DATE, ftDate_1123},
96
97
    {"ETag", HDR_ETAG, ftETag},
97
98
    {"Expires", HDR_EXPIRES, ftDate_1123},
121
122
    {"Retry-After", HDR_RETRY_AFTER, ftStr},    /* for now (ftDate_1123 or ftInt!) */
122
123
    {"Server", HDR_SERVER, ftStr},
123
124
    {"Set-Cookie", HDR_SET_COOKIE, ftStr},
 
125
    {"Set-Cookie2", HDR_SET_COOKIE2, ftStr},
124
126
    {"TE", HDR_TE, ftStr},
125
127
    {"Title", HDR_TITLE, ftStr},
126
 
    {"Trailers", HDR_TRAILERS, ftStr},
 
128
    {"Trailer", HDR_TRAILER, ftStr},
127
129
    {"Transfer-Encoding", HDR_TRANSFER_ENCODING, ftStr},
128
130
    {"Translate", HDR_TRANSLATE, ftStr},        /* for now. may need to crop */
129
131
    {"Unless-Modified-Since", HDR_UNLESS_MODIFIED_SINCE, ftStr},  /* for now ignore. may need to crop */
184
186
    HDR_UPGRADE,
185
187
    HDR_VARY,
186
188
    HDR_VIA,
187
 
    /* HDR_WARNING, */
 
189
    HDR_WARNING,
188
190
    HDR_WWW_AUTHENTICATE,
189
191
    HDR_AUTHENTICATION_INFO,
190
192
    HDR_PROXY_AUTHENTICATION_INFO,
222
224
    HDR_ACCEPT, HDR_ACCEPT_CHARSET, HDR_ACCEPT_ENCODING, HDR_ACCEPT_LANGUAGE,
223
225
    HDR_ACCEPT_RANGES, HDR_AGE,
224
226
    HDR_LOCATION, HDR_MAX_FORWARDS,
225
 
    HDR_MIME_VERSION, HDR_PUBLIC, HDR_RETRY_AFTER, HDR_SERVER, HDR_SET_COOKIE,
 
227
    HDR_MIME_VERSION, HDR_PUBLIC, HDR_RETRY_AFTER, HDR_SERVER, HDR_SET_COOKIE, HDR_SET_COOKIE2,
226
228
    HDR_VARY,
227
229
    HDR_WARNING, HDR_PROXY_CONNECTION, HDR_X_CACHE,
228
230
    HDR_X_CACHE_LOOKUP,
249
251
static HttpHeaderMask HopByHopHeadersMask;
250
252
static http_hdr_type HopByHopHeadersArr[] = {
251
253
    HDR_CONNECTION, HDR_KEEP_ALIVE, /*HDR_PROXY_AUTHENTICATE,*/ HDR_PROXY_AUTHORIZATION,
252
 
    HDR_TE, HDR_TRAILERS, HDR_TRANSFER_ENCODING, HDR_UPGRADE, HDR_PROXY_CONNECTION
 
254
    HDR_TE, HDR_TRAILER, HDR_TRANSFER_ENCODING, HDR_UPGRADE, HDR_PROXY_CONNECTION
253
255
};
254
256
 
255
257
/* header accounting */
647
649
        addEntry(e);
648
650
    }
649
651
 
 
652
    if (chunked()) {
 
653
        // RFC 2616 section 4.4: ignore Content-Length with Transfer-Encoding
 
654
        delById(HDR_CONTENT_LENGTH);
 
655
    }
 
656
 
650
657
    PROF_stop(HttpHeaderParse);
651
658
    return 1;                   /* even if no fields where found, it is a valid header */
652
659
reset:
1183
1190
    mb.clean();
1184
1191
}
1185
1192
 
 
1193
void
 
1194
HttpHeader::putWarning(const int code, const char *const text)
 
1195
{
 
1196
    char buf[512];
 
1197
    snprintf(buf, sizeof(buf), "%i %s \"%s\"", code, visible_appname_string, text);
 
1198
    putStr(HDR_WARNING, buf);
 
1199
}
 
1200
 
1186
1201
/* add extension header (these fields are not parsed/analyzed/joined, etc.) */
1187
1202
void
1188
1203
HttpHeader::putExt(const char *name, const char *value)