--------------------- PatchSet 9906 Date: 2007/08/23 01:26:39 Author: hno Branch: http11 Tag: (none) Log: Various small fixes to make the http11 branch run again some of this is not http11 related and should be merged back to 2.HEAD Members: configure.in:1.169.2.4->1.169.2.5 src/HttpStatusLine.c:1.9.48.4->1.9.48.5 src/cf.data.pre:1.161.6.6->1.161.6.7 src/client_side.c:1.154.2.20->1.154.2.21 src/enums.h:1.57.6.4->1.57.6.5 src/http.c:1.49.6.11->1.49.6.12 src/tools.c:1.52.6.4->1.52.6.5 Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.169.2.4 retrieving revision 1.169.2.5 diff -u -r1.169.2.4 -r1.169.2.5 --- squid/configure.in 12 Aug 2007 01:13:47 -0000 1.169.2.4 +++ squid/configure.in 23 Aug 2007 01:26:39 -0000 1.169.2.5 @@ -1,7 +1,7 @@ dnl dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.169.2.4 2007/08/12 01:13:47 hno Exp $ +dnl $Id: configure.in,v 1.169.2.5 2007/08/23 01:26:39 hno Exp $ dnl dnl dnl @@ -10,7 +10,7 @@ AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE -AC_REVISION($Revision: 1.169.2.4 $)dnl +AC_REVISION($Revision: 1.169.2.5 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -1665,6 +1665,7 @@ db.h \ db_185.h \ aio.h \ + sys/capability.h \ ,,,[ #if HAVE_SYS_TYPES_H #include Index: squid/src/HttpStatusLine.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpStatusLine.c,v retrieving revision 1.9.48.4 retrieving revision 1.9.48.5 diff -u -r1.9.48.4 -r1.9.48.5 --- squid/src/HttpStatusLine.c 12 Aug 2007 01:13:59 -0000 1.9.48.4 +++ squid/src/HttpStatusLine.c 23 Aug 2007 01:26:39 -0000 1.9.48.5 @@ -1,6 +1,6 @@ /* - * $Id: HttpStatusLine.c,v 1.9.48.4 2007/08/12 01:13:59 hno Exp $ + * $Id: HttpStatusLine.c,v 1.9.48.5 2007/08/23 01:26:39 hno Exp $ * * DEBUG: section 57 HTTP Status-line * AUTHOR: Alex Rousskov @@ -279,6 +279,9 @@ case HTTP_HTTP_VERSION_NOT_SUPPORTED: p = "HTTP Version not supported"; break; + case HTTP_EXPECTATION_FAILED: + p = "Expectation failed"; + break; default: p = "Unknown"; debug(57, 3) ("Unknown HTTP status code: %d\n", status); Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.161.6.6 retrieving revision 1.161.6.7 diff -u -r1.161.6.6 -r1.161.6.7 --- squid/src/cf.data.pre 17 Aug 2007 11:30:33 -0000 1.161.6.6 +++ squid/src/cf.data.pre 23 Aug 2007 01:26:39 -0000 1.161.6.7 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.161.6.6 2007/08/17 11:30:33 hno Exp $ +# $Id: cf.data.pre,v 1.161.6.7 2007/08/23 01:26:39 hno Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -119,9 +119,9 @@ This currently means generate own Date: and Expires: headers. Implies accel. - http11 Enables HTTP/1.1 support to clients. The HTTP/1.1 - support is still incomplete, but should work with - most clients. + http11 Enables HTTP/1.1 support to clients. The HTTP/1.1 + support is still incomplete, but should work with + most clients. If you run Squid on a dual-homed machine with an internal and an external interface we recommend you to specify the @@ -2611,6 +2611,17 @@ or response to be rejected. DOC_END +NAME: server_http11 +COMMENT: on|off +TYPE: onoff +LOC: Config.onoff.server_http11 +DEFAULT: off +DOC_START + This option enables the use ot HTTP/1.1 on outgoing "direct" requests. + See also the http11 cache_peer option. + Note: The HTTP/1.1 support is still incomplete. +DOC_END + COMMENT_START TIMEOUTS ----------------------------------------------------------------------------- Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.154.2.20 retrieving revision 1.154.2.21 diff -u -r1.154.2.20 -r1.154.2.21 --- squid/src/client_side.c 17 Aug 2007 11:30:33 -0000 1.154.2.20 +++ squid/src/client_side.c 23 Aug 2007 01:26:41 -0000 1.154.2.21 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.154.2.20 2007/08/17 11:30:33 hno Exp $ + * $Id: client_side.c,v 1.154.2.21 2007/08/23 01:26:41 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3235,6 +3235,13 @@ RequestMethods[r->method].str, url); r->flags.collapsed = 0; + if (httpHeaderHas(&r->header, HDR_EXPECT)) { + 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; + } if (r->method == METHOD_CONNECT && !http->redirect.status) { http->log_type = LOG_TCP_MISS; #if USE_SSL && SSL_CONNECT_INTERCEPT Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.57.6.4 retrieving revision 1.57.6.5 diff -u -r1.57.6.4 -r1.57.6.5 --- squid/src/enums.h 12 Aug 2007 01:14:01 -0000 1.57.6.4 +++ squid/src/enums.h 23 Aug 2007 01:26:41 -0000 1.57.6.5 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.57.6.4 2007/08/12 01:14:01 hno Exp $ + * $Id: enums.h,v 1.57.6.5 2007/08/23 01:26:41 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -500,6 +500,7 @@ HTTP_REQUEST_ENTITY_TOO_LARGE = 413, HTTP_REQUEST_URI_TOO_LONG = 414, HTTP_UNSUPPORTED_MEDIA_TYPE = 415, + HTTP_EXPECTATION_FAILED = 417, HTTP_UNPROCESSABLE_ENTITY = 422, /* RFC2518 section 10.3 */ HTTP_LOCKED = 423, /* RFC2518 section 10.4 */ HTTP_FAILED_DEPENDENCY = 424, /* RFC2518 section 10.5 */ Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.49.6.11 retrieving revision 1.49.6.12 diff -u -r1.49.6.11 -r1.49.6.12 --- squid/src/http.c 12 Aug 2007 01:14:02 -0000 1.49.6.11 +++ squid/src/http.c 23 Aug 2007 01:26:42 -0000 1.49.6.12 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.49.6.11 2007/08/12 01:14:02 hno Exp $ + * $Id: http.c,v 1.49.6.12 2007/08/23 01:26:42 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -432,7 +432,7 @@ debug(11, 3) ("httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", httpState->reply_hdr.buf); httpState->reply_hdr_state += 2; httpState->chunk_size = -1; /* Terminated by EOF */ - memBufClean(&httpState->reply_hdr); + httpState->reply_hdr.size = old_size; httpBuildVersion(&reply->sline.version, 0, 9); reply->sline.status = HTTP_INVALID_HEADER; ctx_exit(ctx); @@ -472,8 +472,19 @@ /* Parse headers into reply structure */ /* what happens if we fail to parse here? */ httpReplyParse(reply, httpState->reply_hdr.buf, hdr_size); - storeAppend(entry, httpState->reply_hdr.buf, hdr_size); done = hdr_size - old_size; + /* 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); if (reply->sline.status >= HTTP_INVALID_HEADER) { debug(11, 3) ("httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", httpState->reply_hdr.buf); memBufClean(&httpState->reply_hdr); @@ -955,6 +966,8 @@ httpHeaderPutTime(&reply->header, HDR_DATE, squid_curtime); mb = httpReplyPack(reply); storeAppend(entry, mb.buf, mb.size); + storeAppend(entry, httpState->reply_hdr.buf, httpState->reply_hdr.size); + memBufClean(&httpState->reply_hdr); httpReplyReset(reply); httpReplyParse(reply, mb.buf, mb.size); memBufClean(&mb); @@ -1185,7 +1198,6 @@ case HDR_TRANSFER_ENCODING: case HDR_UPGRADE: case HDR_PROXY_CONNECTION: - case HDR_EXPECT: /* hop-by-hop headers. Don't forward */ break; case HDR_CACHE_CONTROL: @@ -1208,6 +1220,8 @@ orig_request->http_ver.major, orig_request->http_ver.minor, ThisCache); strListAdd(&strVia, bbuf, ','); + if (flags.http11) + strListAdd(&strVia, "1.0 internal", ','); httpHeaderPutStr(hdr_out, HDR_VIA, strBuf(strVia)); stringClean(&strVia); } Index: squid/src/tools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/tools.c,v retrieving revision 1.52.6.4 retrieving revision 1.52.6.5 diff -u -r1.52.6.4 -r1.52.6.5 --- squid/src/tools.c 17 Aug 2007 11:30:36 -0000 1.52.6.4 +++ squid/src/tools.c 23 Aug 2007 01:26:42 -0000 1.52.6.5 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.52.6.4 2007/08/17 11:30:36 hno Exp $ + * $Id: tools.c,v 1.52.6.5 2007/08/23 01:26:42 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -41,6 +41,7 @@ #include "squid.h" #ifdef _SQUID_LINUX_ +#if HAVE_SYS_CAPABILITY_H #undef _POSIX_SOURCE /* Ugly glue to get around linux header madness colliding with glibc */ #define _LINUX_TYPES_H @@ -48,6 +49,7 @@ typedef uint32_t __u32; #include #endif +#endif #if HAVE_SYS_PRCTL_H #include @@ -1339,7 +1341,7 @@ void keepCapabilities(void) { -#if HAVE_PRCTL && defined(PR_SET_KEEPCAPS) +#if HAVE_PRCTL && defined(PR_SET_KEEPCAPS) && HAVE_SYS_CAPABILITY_H if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) { /* Silent failure unless TPROXY is required. Maybe not started as root */ #if LINUX_TPROXY @@ -1354,7 +1356,7 @@ static void restoreCapabilities(int keep) { -#ifdef _SQUID_LINUX_ +#if defined(_SQUID_LINUX_) && HAVE_SYS_CAPABILITY_H cap_user_header_t head = (cap_user_header_t) xcalloc(1, sizeof(cap_user_header_t)); cap_user_data_t cap = (cap_user_data_t) xcalloc(1, sizeof(cap_user_data_t)); @@ -1388,6 +1390,12 @@ nocap: xfree(head); xfree(cap); +#else +#if LINUX_TPROXY + if (need_linux_tproxy) + debug(50, 1) ("Missing needed capability support. Will continue without tproxy support\n"); + need_linux_tproxy = 0; +#endif #endif }