Passing variables between squid and C-ICAP

2014-05-20 Thread m . shahverdi
Hi, Is it possible to pass variables between squid and C-ICAP(for example by adding fields to requests or responses)? Thanks MSH

FYI: the C++11 roadmap

2014-05-05 Thread Amos Jeffries
I have just announced the change in 3.4.5 regarding C++11 support and accompanied it with a notice that GCC verion 4.8 is likely to become the minimum version later this calendar year. As it stands (discussed earlier): * Squid-3.4 needs to build with any GCC 4.0+ version with C++03. * Squid-3.6

Re: [PATCH] SBuf c-string comparisons

2014-04-21 Thread Amos Jeffries
On 22/04/2014 3:17 a.m., Alex Rousskov wrote: > On 04/20/2014 02:08 AM, Amos Jeffries wrote: > >> +while ((rv = *left - *right++) == 0) { >> +if (*left++ == '\0' || --byteCount == 0) >> +break; >> +} > >> +// If we stopped scanning because we reache

Re: [PATCH] SBuf c-string comparisons

2014-04-21 Thread Alex Rousskov
On 04/20/2014 02:08 AM, Amos Jeffries wrote: > +while ((rv = *left - *right++) == 0) { > +if (*left++ == '\0' || --byteCount == 0) > +break; > +} > +// If we stopped scanning because we reached the end of buf() > +if (!byteCount && length() < n)

Re: [PATCH] SBuf c-string comparisons

2014-04-20 Thread Amos Jeffries
length comparison is always true regardless of buffer states +if (!n) { +++stats.compareFast; + return 0; +} + +// N-length compare MUST provide a non-NULL C-string pointer +assert(s); + +// when this is a 0-length string, no need for any complexity. +

Re: [PATCH] SBuf c-string comparisons

2014-04-18 Thread Alex Rousskov
On 04/18/2014 12:12 PM, Amos Jeffries wrote: > I see you are suggesting the FreeBSD libc strncmp() method > http://fxr.watson.org/fxr/source/string/strncmp.c?v=FREEBSD6-LIBC I have not seen that FreeBSD code before, and I do not think my sketch is similar to it. IIRC, my sketch is similar to th

Re: [PATCH] SBuf c-string comparisons

2014-04-18 Thread Amos Jeffries
s instead of the strncmp() optimized code. > >> The cloning mechanism uses strlen() internally. So no benefit, but extra >> malloc+free costs. > > AFAICT, cloning should not call strlen(). We are cloning the SBuf object > ("this") which has a known length. We are not

Re: [PATCH] SBuf c-string comparisons

2014-04-17 Thread Alex Rousskov
ally. So no benefit, but extra > malloc+free costs. AFAICT, cloning should not call strlen(). We are cloning the SBuf object ("this") which has a known length. We are not cloning the c-string. The only purpose of cloning is null termination of "this" -- SBuf::c_str() is not a

Re: [PATCH] SBuf c-string comparisons

2014-04-17 Thread Amos Jeffries
6 if (c1 == '\0' || c1 != c2) 57 return c1 - c2; 58 } while (--n4 > 0); 59 n &= 3; 60 } 61 62 while (n > 0) 63 { 64 c1 = (unsigned char) *s1++; 65 c2 = (unsigned char) *s2++; 66 if (c1 == '\0' || c1 != c2) 67 return c1 - c2; 68 n--; 69 } 70 > >&g

Re: [PATCH] SBuf c-string comparisons

2014-04-16 Thread Alex Rousskov
is a tricky "_if_" to code for. I hope the above clarifies that no coding is necessary for this _if_. > So... > trying to find a way to determine the length of a c-string potentially > unterminated, without using strlen() or otherwise looping over it. > OR, > trying to

Re: [PATCH] SBuf c-string comparisons

2014-04-16 Thread Amos Jeffries
hand-craft memCaseCmp IIRC. Personally, I would hand-craft _if_ system > implementation of strncmp() is just a basic loop rather than some > complicated, optimized low-level code. Otherwise, I would find a way to > avoid strlen(). Which system? which architecture? which compiler? which library? Th

Re: [PATCH] SBuf c-string comparisons

2014-04-16 Thread Alex Rousskov
w methods with "Requires S to be null-terminated.". I do not see why we should change (and limit) the "standard" API in this case. > Is this acceptible to you after those minor changes? I disagree that we should limit the API to require terminated c-strings. Sorry, Alex.

Re: [PATCH] SBuf c-string comparisons

2014-04-15 Thread Amos Jeffries
new methods with "Requires S to be null-terminated.". Since the default n=npos case also requires that it may as well be a constant requirement. NP: callers playing with un-termianted C-strings in old Squid code are usually broken as-is. Not to say there aren't any though. (N

Re: [PATCH] SBuf c-string comparisons

2014-04-15 Thread Alex Rousskov
On 04/15/2014 08:55 AM, Amos Jeffries wrote: > The attached patch passes all the tests including \0 embeded in the strings. If I am reading the code correctly, there is a new bug: > It also avoids the s[] access by using strlen(s) != byteCompareLen. > +if (byteCompareLen < n && strlen(s) !

Re: [PATCH] SBuf c-string comparisons

2014-04-15 Thread Amos Jeffries
gt;>> strncmp/strncasecmp return 0 up to infinity. >>> >>> Yes, this is related to the large-n handling bug I keep talking about. >>> IMO, this must be fixed as previously discussed: C-string API should not >>> look past the first null character. >>

Re: [PATCH] SBuf c-string comparisons

2014-04-14 Thread Alex Rousskov
foo", 9); >>> >>> It works fine up to the point N(4) > strlen("foo"). After that point our >>> function returns 1 to indicate that the SBuf is a longer string, whereas >>> strncmp/strncasecmp return 0 up to infinity. >> >> Yes, this i

Re: [PATCH] SBuf c-string comparisons

2014-04-14 Thread Amos Jeffries
the point N(4) > strlen("foo"). After that point our >> function returns 1 to indicate that the SBuf is a longer string, whereas >> strncmp/strncasecmp return 0 up to infinity. > > Yes, this is related to the large-n handling bug I keep talking about. > IMO, this mus

Re: [PATCH] SBuf c-string comparisons

2014-04-14 Thread Alex Rousskov
ction returns 1 to indicate that the SBuf is a longer string, whereas > strncmp/strncasecmp return 0 up to infinity. Yes, this is related to the large-n handling bug I keep talking about. IMO, this must be fixed as previously discussed: C-string API should not look past the first null cha

Re: [PATCH] SBuf c-string comparisons

2014-04-14 Thread Amos Jeffries
On 14/04/2014 5:53 a.m., Alex Rousskov wrote: > On 04/13/2014 05:13 AM, Amos Jeffries wrote: >>>> +/// comparison with a C-string >>>> +int compare(const char *s, SBufCaseSensitive isCaseSensitive, const >>>> size_type n) const; >>> ...

Re: [PATCH] SBuf c-string comparisons

2014-04-13 Thread Alex Rousskov
On 04/13/2014 05:13 AM, Amos Jeffries wrote: >>> +/// comparison with a C-string >>> +int compare(const char *s, SBufCaseSensitive isCaseSensitive, const >>> size_type n) const; >> ... >>> +const size_type byteCompareLen = min(n, length());

Re: [PATCH] SBuf c-string comparisons

2014-04-13 Thread Amos Jeffries
;& !s) part (as already discussed on > #squidev?). IMO, Squid should assert if somebody tries to compare SBuf > with an unknown number of characters (npos and !s), as opposed to > comparing SBuf with zero characters (!n). > Done. > >> +/// comparison with a C-string &

Re: [PATCH] SBuf c-string comparisons

2014-04-12 Thread Alex Rousskov
with an unknown number of characters (npos and !s), as opposed to comparing SBuf with zero characters (!n). > +/// comparison with a C-string > +int compare(const char *s, SBufCaseSensitive isCaseSensitive, const > size_type n) const; ... > +const size_type byteCompareLen = mi

Re: [PATCH] SBuf c-string comparisons

2014-04-11 Thread Amos Jeffries
> callers might be needed). Done and const n. > >> +/// comparison with a C-string >> +int cmp(const char *s, size_t n) const; >> + >> +/// case-insensitive comparison with a C-string >> +int caseCmp(const char *s, size_t n) const; > > The

Re: c++0x and RHEL5.X

2013-12-31 Thread Alex Rousskov
On 12/30/2013 03:21 AM, Kinkie wrote: > we have been talking about mandating c++11 some time in the next few months. The "next few months" timeframe is not realistic IMO: There is relatively little for Squid to gain from that requirement (without a lot more work on our part) a

Re: c++0x and RHEL5.X

2013-12-30 Thread Kinkie
some like CentOS >> etc only a short few years away from EOL on the non-working versions >> (probably with packages available for the preferred compiler versions). >> >> PPS. Anything we do in the C++11 direction before 2015 will probably >> still require macros and wrap

Re: c++0x and RHEL5.X

2013-12-30 Thread Marcus Kool
On 12/30/2013 10:16 AM, Amos Jeffries wrote: On 30/12/2013 11:21 p.m., Kinkie wrote: Hi all, we have been talking about mandating c++11 some time in the next few months. Today I was trying to rely on a c++0x feature, and I realized that RHEL5.X ships gcc 4.1.2, which doesn't support

Re: c++0x and RHEL5.X

2013-12-30 Thread Amos Jeffries
On 30/12/2013 11:21 p.m., Kinkie wrote: > Hi all, >we have been talking about mandating c++11 some time in the next few > months. > Today I was trying to rely on a c++0x feature, and I realized that > RHEL5.X ships gcc 4.1.2, which doesn't support c++0x. RHEL6 ship

c++0x and RHEL5.X

2013-12-30 Thread Kinkie
Hi all, we have been talking about mandating c++11 some time in the next few months. Today I was trying to rely on a c++0x feature, and I realized that RHEL5.X ships gcc 4.1.2, which doesn't support c++0x. RHEL6 ships g++ 4.4.7, which supports c++0x but not c++11. Now, what I need to do

Re: [PATCH] c++-stream-ify purge/conffile.cc

2012-10-26 Thread Kinkie
On Fri, Oct 26, 2012 at 6:37 PM, Alex Rousskov wrote: > On 10/26/2012 09:30 AM, Kinkie wrote: >> Ok, fixed and committed as r12411. > > >> -FILE* in = fopen( fn, "r" ); >> -if ( in == NULL ) { >> +std::ifstream cfgin(fn); >> +if (cfgin) { > > Missing "!" in the if-statement conditi

Re: [PATCH] c++-stream-ify purge/conffile.cc

2012-10-26 Thread Alex Rousskov
u, Oct 25, 2012 at 6:29 PM, Alex Rousskov > wrote: >> On 10/24/2012 11:14 AM, Kinkie wrote: >>> Hi, >>> the attached patch changes purge/conffile.cc to use c++ file streams >>> instaed of C-FILE handles. >>> >>> Ok for merging? >>>

Re: [PATCH] c++-stream-ify purge/conffile.cc

2012-10-26 Thread Kinkie
Ok, fixed and committed as r12411. On Thu, Oct 25, 2012 at 6:29 PM, Alex Rousskov wrote: > On 10/24/2012 11:14 AM, Kinkie wrote: >> Hi, >> the attached patch changes purge/conffile.cc to use c++ file streams >> instaed of C-FILE handles. >> >> Ok for merging

Re: [PATCH] c++-stream-ify purge/conffile.cc

2012-10-25 Thread Alex Rousskov
On 10/24/2012 11:14 AM, Kinkie wrote: > Hi, > the attached patch changes purge/conffile.cc to use c++ file streams > instaed of C-FILE handles. > > Ok for merging? > > -FILE* in = fopen( fn, "r" ); > -if ( in == NULL ) { > +std::ifstre

Re: [PATCH] c++-stream-ify purge/conffile.cc

2012-10-24 Thread Amos Jeffries
On 25.10.2012 06:14, Kinkie wrote: Hi, the attached patch changes purge/conffile.cc to use c++ file streams instaed of C-FILE handles. Ok for merging? +1. But please remove the whitespace around "!cfgin.good()" and before first parameter of cfgin.getline(). FYI: I'm in

[PATCH] c++-stream-ify purge/conffile.cc

2012-10-24 Thread Kinkie
Hi, the attached patch changes purge/conffile.cc to use c++ file streams instaed of C-FILE handles. Ok for merging? -- /kinkie purge-conffile-fstreamify.patch Description: Binary data

Re: [PATCH] Fix build with GCC 4.7 (and probably other C++11 compilers).

2012-06-21 Thread Alex Rousskov
On 06/20/2012 07:12 PM, Amos Jeffries wrote: > On 20.06.2012 22:37, Dmitry Kurochkin wrote: >> Hi all. >> >> C++11 introduced user-defined literals, it breaks some code which >> was valid before. In particular, whitespace is now needed after >> a string literal a

Re: [PATCH] Fix build with GCC 4.7 (and probably other C++11 compilers).

2012-06-20 Thread Amos Jeffries
On 20.06.2012 22:37, Dmitry Kurochkin wrote: Hi all. C++11 introduced user-defined literals, it breaks some code which was valid before. In particular, whitespace is now needed after a string literal and before something that could be a valid user-defined literal. See "User-defined lit

[PATCH] Fix build with GCC 4.7 (and probably other C++11 compilers).

2012-06-20 Thread Dmitry Kurochkin
Hi all. C++11 introduced user-defined literals, it breaks some code which was valid before. In particular, whitespace is now needed after a string literal and before something that could be a valid user-defined literal. See "User-defined literals and whitespace" section at [1] for mo

Re: [PATCH] FileMap c++ refactoring

2011-12-07 Thread Kinkie
Committed. --     /kinkie

Re: [PATCH] HttpHdrSc c++ refactoring

2011-12-03 Thread Kinkie
On Thu, Dec 1, 2011 at 7:57 AM, Kinkie wrote: > Hi all, >  it's been 13 days since the last comment on this thread. > May I assume go-ahead for commit? Now merged. --     /kinkie

Re: [PATCH] HttpHdrSc c++ refactoring

2011-11-30 Thread Kinkie
Hi all, it's been 13 days since the last comment on this thread. May I assume go-ahead for commit? On Fri, Nov 18, 2011 at 8:42 AM, Kinkie wrote: >>> +/** >>> + * look for the last occurrence of a character in a c-string with a set >>> maximum length >&

Re: [PATCH] FileMap c++ refactoring

2011-11-27 Thread Kinkie
>> changed to sfileno used_slots_ >> > > Err... camelCase_ > > Whoops, sorry. I thought that the convention didn't apply to private data members. >>> NP: also this would be a good time to add that bounds checking and ensure >>> the n_files_in_map is correctly maintained by its owner class. Espec

Re: [PATCH] FileMap c++ refactoring

2011-11-27 Thread Amos Jeffries
On Sun, 27 Nov 2011 19:55:51 +0100, Kinkie wrote:  * n_files_in_map would be best called something_ internally. Also this should be unsigned. changed to sfileno used_slots_ Err... camelCase_ NP: also this would be a good time to add that bounds checking and ensure the n_files_in_map

Re: [PATCH] FileMap c++ refactoring

2011-11-27 Thread Kinkie
,0 +1,102 @@ +/* + * FileMap.h + * + * DEBUG: section 08Swap File Bitmap + * AUTHOR: Harvest Derived + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * -- + * + * Squid is the result of efforts by numerous individ

Re: [PATCH] FileMap c++ refactoring

2011-11-25 Thread Amos Jeffries
On 25/11/2011 4:11 a.m., Kinkie wrote: The above change leaves n_files_in_map uninitialized. In general, please initialize members before entering the body of the constructor. This will save you from bugs such as this one and will also make the code more exception-safe. Done. +/** Compact bit

Re: [PATCH] FileMap c++ refactoring

2011-11-24 Thread Kinkie
ap.h 2011-11-24 10:34:35 + @@ -0,0 +1,101 @@ +/* + * FileMap.h + * + * DEBUG: section 08Swap File Bitmap + * AUTHOR: Harvest Derived + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * -- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community

Re: [PATCH] FileMap c++ refactoring

2011-11-23 Thread Alex Rousskov
On 11/23/2011 04:12 PM, Kinkie wrote: > the attached patch is a direct c++ refactoring and documentation > effort for struct fileMap (which gets renamed class FileMap). > Scope is very limited; only ufs uses this code. Main benefit is the > reduction in pollution in global i

[PATCH] FileMap c++ refactoring

2011-11-23 Thread Kinkie
Hi all, the attached patch is a direct c++ refactoring and documentation effort for struct fileMap (which gets renamed class FileMap). Scope is very limited; only ufs uses this code. Main benefit is the reduction in pollution in global include files. --     /kinkie === added file 

Re: [PATCH] HttpHdrSc c++ refactoring

2011-11-17 Thread Kinkie
>> +/** >> + * look for the last occurrence of a character in a c-string with a set >> maximum length >> + */ >> +SQUIDCEXTERN const char *strnrchr(const char *s, size_t slen, char c); > > Please fix the strnrchr() description. To match the implementation,

Re: [PATCH] HttpHdrSc c++ refactoring

2011-11-17 Thread Alex Rousskov
On 11/17/2011 04:57 PM, Kinkie wrote: > New iteration attached, please review it. > +/** > + * look for the last occurrence of a character in a c-string with a set > maximum length > + */ > +SQUIDCEXTERN const char *strnrchr(const char *s, size_t slen, char c); Pleas

Re: [PATCH] HttpHdrSc c++ refactoring

2011-11-17 Thread Kinkie
---- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for

Re: [PATCH] HttpHdrSc c++ refactoring

2011-10-31 Thread Alex Rousskov
On 10/30/2011 01:17 PM, Kinkie wrote: > Please find attached a new iteration of the patch for review. > -temp = xstrndup (item, initiallen + 1); > - > -if (!((target = strrchr(temp, ';')) && !strchr (target, '"') && > *(target + 1) != '\0')) > +if (!((target = memrchr(it

Re: [PATCH] HttpHdrSc c++ refactoring: strnrchr

2011-10-31 Thread Alex Rousskov
On 10/30/2011 12:55 PM, Kinkie wrote: > On Fri, Oct 28, 2011 at 10:05 PM, Alex Rousskov wrote: >> Can we just use memrchr() instead (and provide it if it is not available)? > Now reverted to memrchr, relying on - I'm not sure memrchr > is part of ISO C. According to a

Re: [PATCH] HttpHdrSc c++ refactoring

2011-10-30 Thread Kinkie
HdrScTarget(const String &target_): >> +        mask(0), max_age(MAX_AGE_UNSET), >> max_stale(MAX_STALE_UNSET),target(target_) {} > > Please add "explicit" to both constructors to avoid implicit conversions > from strings to HttpHdrScTarget. > > BTW, do we really n

Re: [PATCH] HttpHdrSc c++ refactoring: strnrchr

2011-10-30 Thread Kinkie
On Fri, Oct 28, 2011 at 10:05 PM, Alex Rousskov wrote: > On 10/28/2011 09:55 AM, Kinkie wrote: > >> +/** >> + * look for the last occurrence of a character in a c-string with a set >> maximum length >> + */ >> +SQUIDCEXTERN const char *strnrch

Re: [PATCH] HttpHdrSc c++ refactoring

2011-10-28 Thread Alex Rousskov
_stale(MAX_STALE_UNSET),target(target_) {} Please add "explicit" to both constructors to avoid implicit conversions from strings to HttpHdrScTarget. BTW, do we really need the first constructor if there is already a silent conversion from c-string to a String? Try removing it.

Re: [PATCH] HttpHdrSc c++ refactoring: strnrchr

2011-10-28 Thread Alex Rousskov
On 10/28/2011 09:55 AM, Kinkie wrote: > +/** > + * look for the last occurrence of a character in a c-string with a set > maximum length > + */ > +SQUIDCEXTERN const char *strnrchr(const char *s, size_t slen, char c); > + "Maximum c-string length" oxymoron allows for

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-05 Thread Alex Rousskov
On 10/04/2011 10:22 PM, Amos Jeffries wrote: >>>A0. Treat it as max-stale=0. >>>A1. Treat it as valueless max-stale. >>>A2. Ignore it completely. >>>B1. Forward our own valid directive. >>>B2. Forward nothing. >>>B3. Forward the malformed directive. >> Glad we reached co

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Amos Jeffries
On 05/10/11 16:58, Alex Rousskov wrote: On 10/04/2011 07:05 PM, Amos Jeffries wrote: On Tue, 04 Oct 2011 17:39:48 -0600, Alex Rousskov wrote: On 10/04/2011 04:19 PM, Amos Jeffries wrote: On Tue, 04 Oct 2011 08:30:47 -0600, Alex Rousskov wrote: We got a malformed max-stale value. We have only

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Alex Rousskov
On 10/04/2011 07:05 PM, Amos Jeffries wrote: > On Tue, 04 Oct 2011 17:39:48 -0600, Alex Rousskov wrote: >> On 10/04/2011 04:19 PM, Amos Jeffries wrote: >>> On Tue, 04 Oct 2011 08:30:47 -0600, Alex Rousskov wrote: >> We got a malformed max-stale value. We have only >> two options whe

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Amos Jeffries
On Tue, 04 Oct 2011 17:39:48 -0600, Alex Rousskov wrote: On 10/04/2011 04:19 PM, Amos Jeffries wrote: On Tue, 04 Oct 2011 08:30:47 -0600, Alex Rousskov wrote: We got a malformed max-stale value. We have only two options when it comes to that value interpretation, I think: A1. Treat it as

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Alex Rousskov
On 10/04/2011 04:19 PM, Amos Jeffries wrote: > On Tue, 04 Oct 2011 08:30:47 -0600, Alex Rousskov wrote: We got a malformed max-stale value. We have only two options when it comes to that value interpretation, I think: A1. Treat it as valueless max-stale. >

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Amos Jeffries
On Tue, 04 Oct 2011 08:30:47 -0600, Alex Rousskov wrote: On 10/03/2011 08:49 PM, Amos Jeffries wrote: We got a malformed max-stale value. We have only two options when it comes to that value interpretation, I think: A1. Treat it as valueless max-stale. A2. Ignore it completely. BTW,

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Kinkie
On Tue, Oct 4, 2011 at 11:05 PM, Amos Jeffries wrote: > On Tue, 4 Oct 2011 14:00:14 +0200, Kinkie wrote: >> >> If you guys are OK, I'll merge the current implementation, then we can >> alter it post-merge. >> >> Right now what Squid does is A1->B2 for all directives except for >> max-stale, for wh

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Amos Jeffries
On Tue, 4 Oct 2011 14:00:14 +0200, Kinkie wrote: If you guys are OK, I'll merge the current implementation, then we can alter it post-merge. Right now what Squid does is A1->B2 for all directives except for max-stale, for which it does B4 (forward valueless). This is probably the worst thing

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Alex Rousskov
On 10/03/2011 08:49 PM, Amos Jeffries wrote: >> We got a malformed max-stale value. We have only >> two options when it comes to that value interpretation, I think: >> >>A1. Treat it as valueless max-stale. >>A2. Ignore it completely. >> BTW, we have three options

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-04 Thread Kinkie
If you guys are OK, I'll merge the current implementation, then we can alter it post-merge. Right now what Squid does is A1->B2 for all directives except for max-stale, for which it does B4 (forward valueless). This is probably the worst thing that can be done. IMHVO the best thing we could do i

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-03 Thread Amos Jeffries
On Mon, 03 Oct 2011 18:02:38 -0600, Alex Rousskov wrote: On 09/30/2011 09:30 PM, Amos Jeffries wrote: On Thu, 29 Sep 2011 17:59:13 +0200, Kinkie wrote: On Thu, Sep 29, 2011 at 5:55 PM, Alex Rousskov wrote: We got a malformed max-stale value. We have only two options when it comes to that val

Re: [MERGE] c++-refactor HttpHdrCc

2011-10-03 Thread Alex Rousskov
On 09/30/2011 09:30 PM, Amos Jeffries wrote: > On Thu, 29 Sep 2011 17:59:13 +0200, Kinkie wrote: >> On Thu, Sep 29, 2011 at 5:55 PM, Alex Rousskov wrote: > We got a malformed max-stale value. We have only > two options when it comes to that value interpretation, I think: > >A1.

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-30 Thread Amos Jeffries
On Thu, 29 Sep 2011 17:59:13 +0200, Kinkie wrote: On Thu, Sep 29, 2011 at 5:55 PM, Alex Rousskov wrote: On 09/29/2011 09:10 AM, Kinkie wrote: How about proceeding like this? This has already grown way past a "playground" or "refactoring" job (it changes some behaviour). We merge as-is, and th

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-29 Thread Kinkie
On Thu, Sep 29, 2011 at 5:55 PM, Alex Rousskov wrote: > On 09/29/2011 09:10 AM, Kinkie wrote: > >> How about proceeding like this? >> This has already grown way past a "playground" or "refactoring" job >> (it changes some behaviour). >> We merge as-is, and then change the behaviour in a follow-up

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-29 Thread Alex Rousskov
On 09/29/2011 09:10 AM, Kinkie wrote: > How about proceeding like this? > This has already grown way past a "playground" or "refactoring" job > (it changes some behaviour). > We merge as-is, and then change the behaviour in a follow-up commit to trunk. Sounds good to me. >>> Also, wouldn't that

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-29 Thread Kinkie
On Thu, Sep 29, 2011 at 4:28 PM, Alex Rousskov wrote: > On 09/29/2011 12:53 AM, Kinkie wrote: >          case CC_MAX_STALE: >> - >> -            if (!p || !httpHeaderParseInt(p, &cc->max_stale)) { >> +            if (!p || !httpHeaderParseInt(p, &max_stale) || max_stale >

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-29 Thread Alex Rousskov
On 09/29/2011 12:53 AM, Kinkie wrote: >>> case CC_MAX_STALE: >>> >> - >>> >> -if (!p || !httpHeaderParseInt(p, &cc->max_stale)) { >>> >> +if (!p || !httpHeaderParseInt(p, &max_stale) || max_stale < >>> >> 0) { >>> >> debugs(65, 2, "cc: max-stale d

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-28 Thread Kinkie
> std::map for lookups and general code polishing. And you could have > split it into even smaller parts. Yes. For the next one I'll definitely try to split up more, e.g. 1. c++-ification 2. api changes 3. performance keeping the first two separate is going to be not really easy. &g

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-28 Thread Alex Rousskov
On 09/28/2011 04:43 PM, Kinkie wrote: > On Wed, Sep 28, 2011 at 6:02 PM, Alex Rousskov wrote: >> On 09/28/2011 07:23 AM, Kinkie wrote: > For the next class, we may want to do more frequent and smaller > merges, even if it means that there will be an interim phase. Not sure I like the sound of "in

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-28 Thread Alex Rousskov
On 09/28/2011 07:23 AM, Kinkie wrote: > Attached is version 6; run-tested. > Includes StringArea.h this time. Sorry, I found a few more bugs in this patch. They are detailed below, together with a more polishing touches. > +// default constructor is disabled > +StringArea(); Remove. Th

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-27 Thread Alex Rousskov
On 09/27/2011 12:23 AM, Kinkie wrote: >> The "may not be null-terminated" part can be removed, but it would be >> useful to preserve it as it will allow us to use this class for many >> other things. Please note that if you do preserve it, you would need to >> fix comparison functions and add a st

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-26 Thread Alex Rousskov
PM, Kinkie wrote: >> On Tue, Sep 13, 2011 at 6:11 PM, Alex Rousskov >> wrote: >>> On 09/12/2011 05:38 PM, Kinkie wrote: >>>> Hi, >>>> the attached bundle refactors the HttpHdrCc into a c++ class, >>>> attempting also to clean the code up

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-26 Thread Alex Rousskov
On 09/14/2011 12:30 PM, Kinkie wrote: > On Tue, Sep 13, 2011 at 6:11 PM, Alex Rousskov > wrote: >> On 09/12/2011 05:38 PM, Kinkie wrote: >>> Hi, >>> the attached bundle refactors the HttpHdrCc into a c++ class, >>> attempting also to clean the cod

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-14 Thread Alex Rousskov
On 09/13/2011 09:57 PM, Amos Jeffries wrote: > On Tue, 13 Sep 2011 10:11:55 -0600, Alex Rousskov wrote: > >>> void >>> +HttpHdrCc::clear() >>> +{ >>> +mask=0; >>> +max_age=-1; >>> +mask=0; >>> +max_age=-1; >>> +s_maxage=-1; >>> +max_stale=-1; >>> +stale_if_error=0; >>>

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-13 Thread Amos Jeffries
On Tue, 13 Sep 2011 10:11:55 -0600, Alex Rousskov wrote: void +HttpHdrCc::clear() +{ +mask=0; +max_age=-1; +mask=0; +max_age=-1; +s_maxage=-1; +max_stale=-1; +stale_if_error=0; +min_fresh=-1; +other.clean(); +} This duplicates the default constructor. Mask a

Re: [MERGE] c++-refactor HttpHdrCc

2011-09-13 Thread Alex Rousskov
On 09/12/2011 05:38 PM, Kinkie wrote: > Hi, > the attached bundle refactors the HttpHdrCc into a c++ class, > attempting also to clean the code up. Main changes: > - 6 less global functions in protos.h > - 1 less struct in structs.h > - proper c++ construction/destruction s

[MERGE] c++-refactor HttpHdrCc

2011-09-12 Thread Kinkie
Hi, the attached bundle refactors the HttpHdrCc into a c++ class, attempting also to clean the code up. Main changes: - 6 less global functions in protos.h - 1 less struct in structs.h - proper c++ construction/destruction semantics, standard MemPool integration - name->id header parsing

Re: [PATCH] Bug 3229: cf_gen.cc dependency removal / conversion to C++

2011-08-17 Thread Amos Jeffries
On 09/08/11 14:45, Amos Jeffries wrote: This converts the bulk of cf_gen to C++ OOP code. * char* tree members to std::string. Which eliminates xstrdup() and xis*() calls. * structs to classes and replaces calloc/free with new/delete. * link cf_gen_depends.cci directly to autoconf.h defines

Re: [PATCH] Bug 3229: cf_gen.cc dependency removal / conversion to C++

2011-08-09 Thread Amos Jeffries
On 09/08/11 20:11, Kinkie wrote: On Tue, Aug 9, 2011 at 4:45 AM, Amos Jeffries wrote: This converts the bulk of cf_gen to C++ OOP code. Great! (even though my language of choice for converting cf_gen would be perl, not c++, but it makes no sense to rewrite too deeply what is working ) Yeah

Re: [PATCH] Bug 3229: cf_gen.cc dependency removal / conversion to C++

2011-08-09 Thread Kinkie
On Tue, Aug 9, 2011 at 4:45 AM, Amos Jeffries wrote: > > This converts the bulk of cf_gen to C++ OOP code. Great! (even though my language of choice for converting cf_gen would be perl, not c++, but it makes no sense to rewrite too deeply what is working ) >  * char* tree members to st

[PATCH] Bug 3229: cf_gen.cc dependency removal / conversion to C++

2011-08-08 Thread Amos Jeffries
This converts the bulk of cf_gen to C++ OOP code. * char* tree members to std::string. Which eliminates xstrdup() and xis*() calls. * structs to classes and replaces calloc/free with new/delete. * link cf_gen_depends.cci directly to autoconf.h defines. The result of these is that we can

Re: [RFC] enabling C++0x support where available

2011-07-28 Thread Amos Jeffries
On 24/07/11 03:58, Amos Jeffries wrote: I've located autoconf macros for detecting and enabling C++0x support in compilers. Some simple initial tests show it seems to be okay. With this we can continue to follow the compilers as language features are supported. Initially we gain the u

[RFC] enabling C++0x support where available

2011-07-23 Thread Amos Jeffries
I've located autoconf macros for detecting and enabling C++0x support in compilers. Some simple initial tests show it seems to be okay. With this we can continue to follow the compilers as language features are supported. Initially we gain the use of nullptr for extra type safety on poi

Re: [PATCH] Cleanup: require config.h or squid.h first in .c and .cc files

2010-11-08 Thread Alex Rousskov
On 11/06/2010 07:40 PM, Amos Jeffries wrote: These are the code fixes identified by the altered enforcement script which checks the first #include file of each .c/.cc. (separate patch submission) * config.h has been used where none was present so as not to introduce new dependencies * some

[PATCH] Cleanup: require config.h or squid.h first in .c and .cc files

2010-11-06 Thread Amos Jeffries
These are the code fixes identified by the altered enforcement script which checks the first #include file of each .c/.cc. (separate patch submission) * config.h has been used where none was present so as not to introduce new dependencies * some order shuffling for squid.h included too

Re: [PATCH] DNS leak and c->locks < 65535

2010-11-03 Thread Tsantilas Christos
If there is not any objection I will commit this patch to trunk Regards, Christos On 11/02/2010 12:12 PM, Amos Jeffries wrote: On 29/10/10 09:02, Tsantilas Christos wrote: Hi all, this patch try to fix some memory leeks and other problems found on squid DNS subsystem. The description of the

Re: [PATCH] DNS leak and c->locks < 65535

2010-11-02 Thread Amos Jeffries
On 29/10/10 09:02, Tsantilas Christos wrote: Hi all, this patch try to fix some memory leeks and other problems found on squid DNS subsystem. The description of the problem and the documentation of the patch included in patch. Regards, Christos +1. Looks good. Amos -- Please be using Curre

[PATCH] DNS leak and c->locks < 65535

2010-10-28 Thread Tsantilas Christos
ts and may overflow, causing a "c->locks < 65535" assertion. This change fixes the assertion unless there are more DNS leaks or different lock leaks present. === modified file 'src/base/InstanceId.h' --- src/base/InstanceId.h 2010-10-13 00:14:42 + +++ src/base/InstanceId.

Re: [PATCH] Fix libtrie-c on opensolaris

2009-12-01 Thread Kinkie
On Tue, Dec 1, 2009 at 11:28 PM, Amos Jeffries wrote: > On Tue, 1 Dec 2009 17:35:48 +0100, Kinkie wrote: >> Hi all, >>   this opensolaris-specific fix fixes the 3.1 build for me on the >> buildfarm host. However the test fails on a missing distdir target in >> lib/libTrie. >> I've tried fixing it

Re: [PATCH] Fix libtrie-c on opensolaris

2009-12-01 Thread Amos Jeffries
On Tue, 1 Dec 2009 17:35:48 +0100, Kinkie wrote: > Hi all, > this opensolaris-specific fix fixes the 3.1 build for me on the > buildfarm host. However the test fails on a missing distdir target in > lib/libTrie. > I've tried fixing it, but it's out of my league, it seems. Can someone > check it

[PATCH] Fix libtrie-c on opensolaris

2009-12-01 Thread Kinkie
ib /opt/SunStudioExpress/lib/CC4 + do +test -d $dir && LDFLAGS="$LDFLAGS -L$dir" + done + AC_LANG_PUSH([C]) + AC_SEARCH_LIBS([_ex_register],[Crun]) + AC_SEARCH_LIBS([__SUNW_init_iostreams],[Cstd]) + AC_SEARCH_LIBS([_ex_alloc],[C]) + AC_S

Re: /bzr/squid3/trunk/ r10149: skip performing C libTrie unit tests

2009-11-20 Thread Robert Collins
case: the autoconf environment is pretty messy in > "non-canonicalized" environments such as Solaris. In particular, the C > tests require linking against libstdc++, which causes two kind of > issues: finding it (there's at least 6 of the buggers in the test > zone), and

Re: /bzr/squid3/trunk/ r10149: skip performing C libTrie unit tests

2009-11-20 Thread Kinkie
mp: Fri 2009-11-20 21:02:00 +0100 >> message: >>   skip performing C libTrie unit tests > > Please include motivation in commit messages. The diff shows that you > skipped the C tests, but not why. > > And because the motivation is missing, I'm left asking 'w

Re: /bzr/squid3/trunk/ r10149: skip performing C libTrie unit tests

2009-11-20 Thread Amos Jeffries
Robert Collins wrote: On Fri, 2009-11-20 at 21:02 +0100, Francesco Chemolli wrote: revno: 10149 committer: Francesco Chemolli branch nick: trunk timestamp: Fri 2009-11-20 21:02:00 +0100 message: skip performing C libTrie unit tests

  1   2   3   >