Expect-100 handling.

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 02 Mar 2010 13:07:41 +1300

On Tue, 02 Mar 2010 00:12:49 +0100, Henrik Nordström
<henrik_at_henriknordstrom.net> wrote:
> tis 2010-03-02 klockan 11:17 +1300 skrev Amos Jeffries:
>
>> * stripping Expect: headers on requests (by skipping 417 abort plus
>> "request_header_access Expect deny all")
>
> Haven't seen any need for skipping/filtering the Expect header. Squid-2
> forwards any received Expect headers.

It was an option choice.

>
>> * ignoring Expect: headers and stripping the 1xx replies. (as per 2.7
>> ignore_expect_100)
>
> The relevant Squid-2 code reads as follows:
>
> if (httpHeaderHas(&r->header, HDR_EXPECT)) {
> int ignore = 0;
> if (Config.onoff.ignore_expect_100) {
> String expect = httpHeaderGetList(&r->header, HDR_EXPECT);
> if (strCaseCmp(expect, "100-continue") == 0)
> ignore = 1;
> stringClean(&expect);
> }
> if (!ignore) {
> ErrorState *err = errorCon(ERR_INVALID_REQ,
> HTTP_EXPECTATION_FAILED, r);
> http->log_type = LOG_TCP_MISS;
> http->entry = clientCreateStoreEntry(http,
> http->request->method, null_request_flags);
> errorAppendEntry(http->entry, err);
> return;
> }
> }
>
>
> that's all there is, as there is no way Squid-2 can fulfill any Expect
> rules yet...
>

2.7 also unconditionally strips the 1xx response snippets out of the reply
before they reach the store entry in src/http.cc line 474.

+ /* Skip 1xx messages for now. Advertised in Via as an internal 1.0
hop */
+ if (reply->sline.status >= 100 && reply->sline.status < 200) {
+ memBufClean(&httpState->reply_hdr);
+ httpReplyReset(reply);
+ httpState->reply_hdr_state = 0;
+ ctx_exit(ctx);
+ if (done < size)
+ return done + httpProcessReplyHeader(httpState, buf + done, size -
done);
+ else
+ return done;
+ }
+ storeAppend(entry, httpState->reply_hdr.buf, hdr_size);

What I've spent the last month or so thinking is that to implement correct
Expect: handling we have only to do this:

 1) bump a call/something to pass the snippet above on to the client
 2) perform the above removal to keep it out of the cache
 3) drop the keep-alive test killing connections with early reply data
(bug 2176)

Amos
Received on Tue Mar 02 2010 - 00:07:45 MST

This archive was generated by hypermail 2.2.0 : Tue Mar 02 2010 - 12:00:04 MST