RE: cvs commit: squid/src wccp2.c

2006-10-25 Thread Steven Wilton
Oops, I assumed that because the bug reporter had "applied the patch" it
would compile correctly.

I've now tested and comitted a new version that compiles :)

Steven

> -Original Message-
> From: Guido Serassio [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 26 October 2006 3:15 AM
> To: Squid Developers
> Cc: [EMAIL PROTECTED]
> Subject: Re: cvs commit: squid/src wccp2.c
> 
> Hi Steven,
> 
> Il 08.26 24/10/2006 Steven Wilton ha scritto:
> >swilton 2006/10/24 00:26:51 MDT
> >
> >   Modified files:
> > src  wccp2.c
> >   Log:
> >   Bug # > 
> href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1790";>1790 
> > : Crash on wccp2 + mask assignement + standard wccp service
> >
> >   The origianl wccp2 mask assignment did not account for the use of 
> > the standard
> >   wccp service in the mask assignment code.
> >
> >   Revision  ChangesPath
> >   1.27  +4 -4  squid/src/wccp2.c
> 
> There is some problem in your patch:
> 
> if gcc -DHAVE_CONFIG_H 
> -DDEFAULT_CONFIG_FILE=\"/usr/local/squid/etc/squid.conf\" -I. -I. 
> -I../include -I. -I. -I../include -I../include-m32 
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -g -O2 -D_REENTRANT 
> -MT wccp2.o -MD -MP -MF ".deps/wccp2.Tpo" -c -o wccp2.o wccp2.c; \
> then mv -f ".deps/wccp2.Tpo" ".deps/wccp2.Po"; else rm -f 
> ".deps/wccp2.Tpo"; exit 1; fi
> wccp2.c: In function `wccp2Init':
> wccp2.c:625: error: `service' undeclared (first use in this function)
> wccp2.c:625: error: (Each undeclared identifier is reported only once
> wccp2.c:625: error: for each function it appears in.)
> wccp2.c: In function `wccp2AssignBuckets':
> wccp2.c:1450: error: `service' undeclared (first use in this function)
> make[3]: *** [wccp2.o] Error 1
> make[3]: Leaving directory `/home/serassio/2.6/src'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory `/home/serassio/2.6/src'
> make[1]: *** [all] Error 2
> make[1]: Leaving directory `/home/serassio/2.6/src'
> make: *** [all-recursive] Error 1
> 
> Regards
> 
> Guido
> 
> 
> -
> 
> Guido Serassio
> Acme Consulting S.r.l. - Microsoft Certified Partner
> Via Lucia Savarino, 1   10098 - Rivoli (TO) - ITALY
> Tel. : +39.011.9530135  Fax. : +39.011.9781115
> Email: [EMAIL PROTECTED]
> WWW: http://www.acmeconsulting.it/
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.408 / Virus Database: 268.13.11/496 - Release 
> Date: 24/10/2006
>  
> 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.11/497 - Release Date: 25/10/2006
 



Squid3 and multiple ICAP services

2006-10-25 Thread Alex Rousskov
Hi there,

Handling of multiple ICAP services in Squid3 does not match squid.conf
expectations well. Here is a brief summary of the current state, with
Squid2 comparison:

load balancing (using similar services in a round-robin):
  Squid2: via multiple identically named icap_service options
  Squid3: not documented and not supported.

backup (using another service when a similar service is down):
  Squid2: via multiple identically named icap_service options
  Squid3: not documented but supported via icap_class option

chaining (applying one service after another):
  Squid2: via icap_class option
  Squid3: semi-documented but not supported

I believe that using multiple identically named icap_service options is
a bad interface. Each service should have its own name for configuration
clarity, reporting, debugging, and such.

The way chaining is explained in squid3.conf will confuse many users.
The name of the option (icap_class) does not imply chaining either. Many
users will think that icap_class is about backup, not chaining. In fact,
the original Squid3 implementation was using icap_class for something
resembling backup, not chaining.

I would like to polish this for Squid3 STABLE release, but since my
proposal requires changing squid.conf option names, I do not want to do
it without your feedback. Here is what I would like to do:

service naming:
  Each service must have a unique name.

load balancing and backup:
  Add icap_service_set option. Services (or service chains) listed under
this option are load balanced and "down" entries are skipped.

chaining:
  Rename icap_class into icap_service_chain option. Services (or service
sets) listed under this option are applied one after another.


Any objections or better ideas?

Thank you,

Alex.
P.S. I am not going to implement load balancing and chaining in Squid3
until somebody needs it enough, but the configuration will be cleaned up
and ready for that implementation. The backup code is already done.




Re: crash when ICAPModXact::parseHead throws

2006-10-25 Thread Gernot Tenchio
On Tue, 24 Oct 2006 08:12:25 -0600
Alex Rousskov <[EMAIL PROTECTED]> wrote:

> If you can reproduce with squid3-icap, please note that the above stack
> trace is missing the first 11 frames. You said that Squid crashes. How
> does it crash? What compiler are you using?

I was using a homebrewed gcc-3.4.6. After recompiling with gcc-4.1.1 it works
as expected.

Gernot


Re: cvs commit: squid/src wccp2.c

2006-10-25 Thread Guido Serassio

Hi Steven,

Il 08.26 24/10/2006 Steven Wilton ha scritto:

swilton 2006/10/24 00:26:51 MDT

  Modified files:
src  wccp2.c
  Log:
  Bug #href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1790";>1790 
: Crash on wccp2 + mask assignement + standard wccp service


  The origianl wccp2 mask assignment did not account for the use of 
the standard

  wccp service in the mask assignment code.

  Revision  ChangesPath
  1.27  +4 -4  squid/src/wccp2.c


There is some problem in your patch:

if gcc -DHAVE_CONFIG_H 
-DDEFAULT_CONFIG_FILE=\"/usr/local/squid/etc/squid.conf\" -I. -I. 
-I../include -I. -I. -I../include -I../include-m32 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -g -O2 -D_REENTRANT 
-MT wccp2.o -MD -MP -MF ".deps/wccp2.Tpo" -c -o wccp2.o wccp2.c; \
then mv -f ".deps/wccp2.Tpo" ".deps/wccp2.Po"; else rm -f 
".deps/wccp2.Tpo"; exit 1; fi

wccp2.c: In function `wccp2Init':
wccp2.c:625: error: `service' undeclared (first use in this function)
wccp2.c:625: error: (Each undeclared identifier is reported only once
wccp2.c:625: error: for each function it appears in.)
wccp2.c: In function `wccp2AssignBuckets':
wccp2.c:1450: error: `service' undeclared (first use in this function)
make[3]: *** [wccp2.o] Error 1
make[3]: Leaving directory `/home/serassio/2.6/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/serassio/2.6/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/serassio/2.6/src'
make: *** [all-recursive] Error 1

Regards

Guido


-

Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1   10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135  Fax. : +39.011.9781115
Email: [EMAIL PROTECTED]
WWW: http://www.acmeconsulting.it/



Re: cvs commit: squid/src wccp2.c

2006-10-25 Thread Guido Serassio

Hi Steven,

Il 08.26 24/10/2006 Steven Wilton ha scritto:

swilton 2006/10/24 00:26:51 MDT

  Modified files:
src  wccp2.c
  Log:
  Bug #href="http://www.squid-cache.org/bugs/show_bug.cgi?id=1790";>1790 
: Crash on wccp2 + mask assignement + standard wccp service


  The origianl wccp2 mask assignment did not account for the use of 
the standard

  wccp service in the mask assignment code.

  Revision  ChangesPath
  1.27  +4 -4  squid/src/wccp2.c


Do you could forward port the changes also to Squid 3 ?
The code is nearly the same.

Thanks

Regards

Guido



-

Guido Serassio
Acme Consulting S.r.l. - Microsoft Certified Partner
Via Lucia Savarino, 1   10098 - Rivoli (TO) - ITALY
Tel. : +39.011.9530135  Fax. : +39.011.9781115
Email: [EMAIL PROTECTED]
WWW: http://www.acmeconsulting.it/



I've completed the part for 'HTTP/1.1 100 Continue'

2006-10-25 Thread zsx
Hi, I've completed the codes for 'HTTP/1.1 100 Continue', and the squid with 
these codes worked well,
I've test some cases for it. Can anybody else give me some suggest to do it 
better?
Thanks
zsx
2006.10.25

The codes added or changed for squid are below:

1) struct.h
struct _HttpStateData {
StoreEntry *entry;
request_t *request;
MemBuf reply_hdr;
+   MemBuf reply_hdr_buf;   /* add by zsx for HTTP1.1---10.1.1 */
..

2) HttpReply.c
static int
httpReplyParseStep(HttpReply * rep, const char *buf, int atEnd)
{
const char *parse_start = buf;
const char *blk_start, *blk_end;
const char **parse_end_ptr = &blk_end;
assert(rep);
assert(parse_start);
assert(rep->pstate < psParsed);

*parse_end_ptr = parse_start;
if (rep->pstate == psReadyToParseStartLine) {
if (!httpReplyIsolateStart(&parse_start, &blk_start, &blk_end))
return 0;
if (!httpStatusLineParse(&rep->sline, blk_start, blk_end))
return httpReplyParseError(rep);

*parse_end_ptr = parse_start;
rep->hdr_sz = *parse_end_ptr - buf;
+/* changed by zsx for http1.1--10.1.1 */
-rep->pstate++;
+if (rep->sline.status != HTTP_CONTINUE)
+rep->pstate++;

..

3) http.c
3.1) I changed the old function from "httpProcessReplyHeader()" to 
"httpProcessReplyHeader()"
and "httpProcessReplyHeader2()", as below:

static void
httpProcessReplyHeader2(HttpStateData * httpState)
{
StoreEntry *entry = httpState->entry;
MemObject *mem = entry->mem_obj;
HttpReply *reply = mem->reply;


if (!peer_supports_connection_pinning(httpState))
httpState->orig_request->flags.no_connection_auth = 1;
storeTimestampsSet(entry);

if (httpHeaderHas(&reply->header, HDR_VARY)
#if X_ACCELERATOR_VARY
|| httpHeaderHas(&reply->header, HDR_X_ACCELERATOR_VARY)
#endif
) {
const char *vary = NULL;
if (Config.onoff.cache_vary)
vary = httpMakeVaryMark(httpState->orig_request, reply);
if (!vary) {
httpMakePrivate(entry);
goto no_cache;
}
entry->mem_obj->vary_headers = xstrdup(vary);

if (strBuf(httpState->orig_request->vary_encoding))
entry->mem_obj->vary_encoding = 
xstrdup(strBuf(httpState->orig_request->vary_encoding));
}

switch (httpCachableReply(httpState)) {
case 1:
httpMakePublic(entry);
break;
case 0:
httpMakePrivate(entry);
break;
case -1:
if (Config.negativeTtl > 0)
httpCacheNegatively(entry);
else
httpMakePrivate(entry);
break;
default:
assert(0);
break;
}
  no_cache:
if (reply->cache_control) {
if (EBIT_TEST(reply->cache_control->mask, CC_PROXY_REVALIDATE))
EBIT_SET(entry->flags, ENTRY_REVALIDATE);
else if (EBIT_TEST(reply->cache_control->mask, CC_MUST_REVALIDATE))
EBIT_SET(entry->flags, ENTRY_REVALIDATE);
}
if (neighbors_do_private_keys && !Config.onoff.collapsed_forwarding)
httpMaybeRemovePublic(entry, reply->sline.status);
if (httpState->flags.keepalive)
if (httpState->peer)
httpState->peer->stats.n_keepalives_sent++;
if (reply->keep_alive) {
if (httpState->peer)
httpState->peer->stats.n_keepalives_recv++;
if (Config.onoff.detect_broken_server_pconns && 
httpReplyBodySize(httpState->request->method, reply) == -1) {
debug(11, 1) ("httpProcessReplyHeader: Impossible keep-alive header 
from '%s'\n", storeUrl(entry));
debug(11, 2) ("GOT HTTP REPLY HDR:\n-\n%s\n--\n",
httpState->reply_hdr.buf);
httpState->flags.keepalive_broken = 1;
}
}
if (reply->date > -1 && !httpState->peer) {
int skew = abs(reply->date - squid_curtime);
if (skew > 86400)
debug(11, 3) ("%s's clock is skewed by %d seconds!\n",
httpState->request->host, skew);
}
#if HEADERS_LOG
headersLog(1, 0, httpState->request->method, reply);
#endif
}

static int
httpProcessReplyHeader(HttpStateData *httpState, const char *buf, int size)
{
char myname[] = "httpProccessReplyHeader";
StoreEntry *entry = httpState->entry;
size_t hdr_len;
size_t hdr_size;
MemObject *mem = entry->mem_obj;
HttpReply *reply = mem->reply;
Ctx ctx = ctx_enter(mem->url);
const char *ptr;
int dlen;

#undefRETURN
#defineRETURN(_x_) do {  \
ctx_exit(ctx);\
return (_x_); \
} while (0)

assert(httpState->reply_hdr_state == 0);

debug(11, 3) ("%s: key '%s'\n",
myname, storeKeyText(entry->hash.key));
if (memBufIsNull(&httpState->reply_hdr))
memBufDefInit(&httpState->reply_hdr);

if (memBufIsNull(&httpState->reply_hdr_buf))
memBufDefInit(&httpState->reply_hdr_buf);

safe_free(entry->mem_obj->vary_headers);
safe_free(entry->mem_obj->vary_encoding);

/* loop parse the header data, just in order to ignore
 * the "HTTP/1.1 100 Continue" header, http1.1--10.1.1
 */
ptr = buf;
dlen = size;
whi