diff -uNr squid-2.6.STABLE12.zph.orig/src/cf.data.pre squid-2.6.STABLE12.zph/src/cf.data.pre --- squid-2.6.STABLE12.zph.orig/src/cf.data.pre 2007-05-16 11:49:31.000000000 +0200 +++ squid-2.6.STABLE12.zph/src/cf.data.pre 2007-05-16 11:55:57.000000000 +0200 @@ -3243,6 +3243,30 @@ Default: 255 (TOS from server is not changed). DOC_END +NAME: zph_tos_acl +TYPE: int +DEFAULT: 0 +LOC: Config.zph_tos_acl +DOC_START + Allows you to select a TOS/Diffserv value to mark if zph_tos_acl_match + is matched. + Read above (tcp_outgoing_tos) for details/requirements about TOS. + Default: 0 (disabled). +DOC_END + +NAME: zph_tos_acl_match +TYPE: acl_access +LOC: Config.accessList.zph_tos_acl_match +DEFAULT: none +DEFAULT_IF_NONE: deny all +DOC_START + Replies to client requests with TOS/Diffser if acl-s is matched. + + acl peer_hit rep_header X-Cache HIT[[:space:]]from[[:space:]]domain\.com + zph_tos_acl 8 + zph_tos_acl_match allow peer_hit +DOC_END + NAME: tcp_outgoing_address TYPE: acl_address DEFAULT: none diff -uNr squid-2.6.STABLE12.zph.orig/src/client_side.c squid-2.6.STABLE12.zph/src/client_side.c --- squid-2.6.STABLE12.zph.orig/src/client_side.c 2007-05-16 11:49:31.000000000 +0200 +++ squid-2.6.STABLE12.zph/src/client_side.c 2007-05-21 18:25:14.365218536 +0200 @@ -2621,8 +2621,18 @@ return; } assert(http->out.offset == 0); - - if ( Config.zph_tos_local || Config.zph_tos_peer || + rep = http->reply = clientBuildReply(http, buf, size); + if (!rep) { + /* Forward as HTTP/0.9 body with no reply */ + MemBuf mb; + memBufDefInit(&mb); + memBufAppend(&mb, buf, size); + http->out.offset += body_size; + comm_write_mbuf(http->conn->fd, mb, clientWriteComplete, http); + return; + } + + if ( Config.zph_tos_local || Config.zph_tos_acl || Config.zph_tos_peer || (Config.onoff.zph_preserve_miss_tos && Config.zph_preserve_miss_tos_mask) ) { int need_change = 0; @@ -2635,7 +2645,17 @@ if (Config.zph_tos_local && isTcpHit(http->log_type)) { /* local hit */ hit = 1; tos = Config.zph_tos_local; - } else if (Config.zph_tos_peer && + } else if (Config.zph_tos_acl) { + aclCheck_t *ch; + ch = clientAclChecklistCreate(Config.accessList.zph_tos_acl_match, http); + ch->reply = http->reply; + if (aclCheckFast(Config.accessList.zph_tos_acl_match, ch)) { /* acl hit */ + hit = 1; + tos = Config.zph_tos_acl; + } + aclChecklistFree(ch); + } + if (!hit && Config.zph_tos_peer && (http->request->hier.code == SIBLING_HIT || /* sibling hit */ (Config.onoff.zph_tos_parent && http->request->hier.code == PARENT_HIT))) { /* parent hit */ @@ -2670,16 +2690,6 @@ debug(33, 1) ("ZPH: setsockopt(IP_TOS) on FD %d: %s\n", fd, xstrerror()); } } - rep = http->reply = clientBuildReply(http, buf, size); - if (!rep) { - /* Forward as HTTP/0.9 body with no reply */ - MemBuf mb; - memBufDefInit(&mb); - memBufAppend(&mb, buf, size); - http->out.offset += body_size; - comm_write_mbuf(http->conn->fd, mb, clientWriteComplete, http); - return; - } if (Config.onoff.log_mime_hdrs) { safe_free(http->al.headers.reply); http->al.headers.reply = xcalloc(rep->hdr_sz + 1, 1); diff -uNr squid-2.6.STABLE12.zph.orig/src/structs.h squid-2.6.STABLE12.zph/src/structs.h --- squid-2.6.STABLE12.zph.orig/src/structs.h 2007-05-16 11:49:31.000000000 +0200 +++ squid-2.6.STABLE12.zph/src/structs.h 2007-05-16 11:55:57.000000000 +0200 @@ -705,6 +705,7 @@ acl_access *reply; acl_address *outgoing_address; acl_tos *outgoing_tos; + acl_tos *zph_tos_acl_match; #if USE_HTCP acl_access *htcp; acl_access *htcp_clr; @@ -797,7 +798,8 @@ external_acl *externalAclHelperList; int zph_tos_local; int zph_tos_peer; - int zph_preserve_miss_tos_mask; + int zph_preserve_miss_tos_mask; + int zph_tos_acl; errormap *errorMapList; #if USE_SSL struct {