----- Original Message -----
From: "Varoli Marco" <Marco.Varoli@elsag.it>
To: <squid-dev@squid-cache.org>
Sent: Wednesday, April 04, 2001 7:39 PM
Subject: Delay Pools and Content Type
>
> Hy,
>
> here the diff to allow bandwidth allocation based on the reply
content-type
> (es: application/octect-stream ...)
That's excellent.
A small thing: you've got the source and dest for your diff the wrong
way around :]
Secondly I have a suggestion? There's an acl type rep_mime_type that has
the logic for checking content_type already. (see the http_reply_access
access list test in client_side.c ).
A more useful and generic approach would be to
a) define a new access list type (ie reply_delay_pool_access pool
allow|deny acl [acl] [acl]...)
b) test that access list for a match when the reply header has been
recieved.
This would handle what you've got today, and also allow easy integration
of TOS fields/other headers in the future.
Rob
>
> To be tested ;-)
>
> Bye
>
> ----------- CUT HERE -------------------
>
> diff -Ncr squid-head-200103300000OK/src/client_side.c
> squid-head-200103300000/src/client_side.c
> *** squid-head-200103300000OK/src/client_side.c Wed Apr 4 10:52:18
2001
> --- squid-head-200103300000/src/client_side.c Sun Mar 4 01:54:48 2001
> ***************
> *** 88,94 ****
> static void checkFailureRatio(err_type, hier_code);
> static void clientProcessMiss(clientHttpRequest *);
> static void clientBuildReplyHeader(clientHttpRequest * http,
HttpReply *
> rep);
> - static HttpReply *clientBuildReply(clientHttpRequest * http, const
char
> *buf, size_t size);
> static clientHttpRequest *parseHttpRequestAbort(ConnStateData *
conn,
> const char *uri);
> static clientHttpRequest *parseHttpRequest(ConnStateData *, method_t
*,
> int *, char **, size_t *);
> static RH clientRedirectDone;
> --- 88,93 ----
> ***************
> *** 1225,1231 ****
> HttpHeader *hdr = &rep->header;
> int is_hit = isTcpHit(http->log_type);
> request_t *request = http->request;
> - debug(33, 2) ("clientBuildReplyHeader: Reply Header %s\n",
> httpHeaderGetStr(hdr, HDR_CONTENT_TYPE));
> #if DONT_FILTER_THESE
> /* but you might want to if you run Squid as an HTTP accelerator
*/
> /* httpHeaderDelById(hdr, HDR_ACCEPT_RANGES); */
> --- 1224,1229 ----
> ***************
> *** 1320,1328 ****
> httpHeaderPutStr(hdr, HDR_X_REQUEST_URI,
> http->entry->mem_obj->url ? http->entry->mem_obj->url : http->uri);
> #endif
> - #if DELAY_POOLS
> - delaySetStoreClient(http->sc, delayClientRep(request,rep));
> - #endif
> httpHdrMangleList(hdr, request);
> }
>
> --- 1318,1323 ----
> ***************
> *** 2183,2189 ****
> clientProcessRequest(clientHttpRequest * http)
> {
> char *url = http->uri;
> - const char *buf;
> request_t *r = http->request;
> int fd = http->conn->fd;
> HttpReply *rep;
> --- 2178,2183 ----
> diff -Ncr squid-head-200103300000OK/src/delay_pools.c
> squid-head-200103300000/src/delay_pools.c
> *** squid-head-200103300000OK/src/delay_pools.c Wed Apr 4 10:53:23
2001
> --- squid-head-200103300000/src/delay_pools.c Mon Mar 19 07:18:42 2001
> ***************
> *** 421,545 ****
> return delayId(pool + 1, position);
> }
>
> - delay_id
> - delayClientRep(request_t * r, HttpReply * rep)
> - {
> - aclCheck_t ch;
> - int i;
> - int j;
> - unsigned int host;
> - unsigned short pool, position;
> - unsigned char class, net;
> -
> - memset(&ch, '\0', sizeof(ch));
> - ch.src_addr = r->client_addr;
> - ch.my_addr = r->my_addr;
> - ch.my_port = r->my_port;
> - ch.request = r;
> - ch.reply = rep;
> - debug(77, 2) ("delayClientRep: Reply Header %s\n",
> httpHeaderGetStr(&ch.reply->header, HDR_CONTENT_TYPE));
> - if (r->client_addr.s_addr == INADDR_BROADCAST) {
> - debug(77, 2) ("delayClientRep: WARNING: Called with 'allones'
> address, ignoring\n");
> - return delayId(0, 0);
> - }
> - for (pool = 0; pool < Config.Delay.pools; pool++) {
> - if (aclCheckFast(Config.Delay.access[pool], &ch))
> - break;
> - }
> - if (pool == Config.Delay.pools)
> - return delayId(0, 0);
> - class = Config.Delay.class[pool];
> - if (class == 0)
> - return delayId(0, 0);
> - if (class == 1)
> - return delayId(pool + 1, 0);
> - if (class == 2) {
> - host = ntohl(ch.src_addr.s_addr) & 0xff;
> - if (host == 255) {
> - if (!delay_data[pool].class2->individual_255_used) {
> - delay_data[pool].class2->individual_255_used = 1;
> - delay_data[pool].class2->individual[IND_MAP_SZ - 1] =
> - (int) (((double)
> Config.Delay.rates[pool]->individual.max_bytes *
> - Config.Delay.initial) / 100);
> - }
> - return delayId(pool + 1, 255);
> - }
> - for (i = 0; i < IND_MAP_SZ; i++) {
> - if (delay_data[pool].class2->individual_map[i] == host)
> - break;
> - if (delay_data[pool].class2->individual_map[i] == 255) {
> - delay_data[pool].class2->individual_map[i] = host;
> - assert(i < (IND_MAP_SZ - 1));
> - delay_data[pool].class2->individual_map[i + 1] = 255;
> - delay_data[pool].class2->individual[i] =
> - (int) (((double)
> Config.Delay.rates[pool]->individual.max_bytes *
> - Config.Delay.initial) / 100);
> - break;
> - }
> - }
> - return delayId(pool + 1, i);
> - }
> - /* class == 3 */
> - host = ntohl(ch.src_addr.s_addr) & 0xffff;
> - net = host >> 8;
> - host &= 0xff;
> - if (net == 255) {
> - i = 255;
> - if (!delay_data[pool].class3->network_255_used) {
> - delay_data[pool].class3->network_255_used = 1;
> - delay_data[pool].class3->network[255] =
> - (int) (((double) Config.Delay.rates[pool]->network.max_bytes
> *
> - Config.Delay.initial) / 100);
> - }
> - } else {
> - for (i = 0; i < NET_MAP_SZ; i++) {
> - if (delay_data[pool].class3->network_map[i] == net)
> - break;
> - if (delay_data[pool].class3->network_map[i] == 255) {
> - delay_data[pool].class3->network_map[i] = net;
> - delay_data[pool].class3->individual_map[i][0] = 255;
> - assert(i < (NET_MAP_SZ - 1));
> - delay_data[pool].class3->network_map[i + 1] = 255;
> - delay_data[pool].class3->network[i] =
> - (int) (((double)
> Config.Delay.rates[pool]->network.max_bytes *
> - Config.Delay.initial) / 100);
> - break;
> - }
> - }
> - }
> - position = i << 8;
> - if (host == 255) {
> - position |= 255;
> - if (!(delay_data[pool].class3->individual_255_used[i / 8] & (1 << (i
> % 8)))) {
> - delay_data[pool].class3->individual_255_used[i / 8] |= (1 << (i
> % 8));
> - assert(position < C3_IND_SZ);
> - delay_data[pool].class3->individual[position] =
> - (int) (((double)
> Config.Delay.rates[pool]->individual.max_bytes *
> - Config.Delay.initial) / 100);
> - }
> - return delayId(pool + 1, position);
> - }
> - assert(i < NET_MAP_SZ);
> - for (j = 0; j < IND_MAP_SZ; j++) {
> - if (delay_data[pool].class3->individual_map[i][j] == host) {
> - position |= j;
> - break;
> - }
> - if (delay_data[pool].class3->individual_map[i][j] == 255) {
> - delay_data[pool].class3->individual_map[i][j] = host;
> - assert(j < (IND_MAP_SZ - 1));
> - delay_data[pool].class3->individual_map[i][j + 1] = 255;
> - position |= j;
> - assert(position < C3_IND_SZ);
> - delay_data[pool].class3->individual[position] =
> - (int) (((double)
> Config.Delay.rates[pool]->individual.max_bytes *
> - Config.Delay.initial) / 100);
> - break;
> - }
> - }
> - return delayId(pool + 1, position);
> - }
> -
> static void
> delayUpdateClass1(class1DelayPool * class1, delaySpecSet * rates,
int
> incr)
> {
> --- 421,426 ----
> diff -Ncr squid-head-200103300000OK/src/protos.h
> squid-head-200103300000/src/protos.h
> *** squid-head-200103300000OK/src/protos.h Mon Apr 2 15:02:11 2001
> --- squid-head-200103300000/src/protos.h Tue Mar 20 02:10:25 2001
> ***************
> *** 1221,1227 ****
> extern void delayClearNoDelay(int fd);
> extern int delayIsNoDelay(int fd);
> extern delay_id delayClient(request_t *);
> - extern delay_id delayClientRep(request_t *, HttpReply *);
> extern EVH delayPoolsUpdate;
> extern int delayBytesWanted(delay_id d, int min, int max);
> extern void delayBytesIn(delay_id, int qty);
> --- 1221,1226 ----
>
>
> Marco Varoli
> Assistenza Elsag
> tel +39 0106583226
> cell+39 03355826018
> e-mail marco.varoli@elsag.it
> e-mail marco.varoli@aitek.it
>
>
>
Received on Wed Apr 04 2001 - 03:51:05 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:44 MST