]> git.ipfire.org Git - thirdparty/squid.git/log
thirdparty/squid.git
12 years agoPolished warning.
The Squid Software Foundation [Fri, 4 Oct 2013 03:45:04 +0000 (21:45 -0600)] 
Polished warning.

12 years agoDo not preserve empty DEBUGs.
The Squid Software Foundation [Fri, 4 Oct 2013 03:43:12 +0000 (21:43 -0600)] 
Do not preserve empty DEBUGs.

12 years agoMerged from trunk
Francesco Chemolli [Thu, 3 Oct 2013 19:07:33 +0000 (21:07 +0200)] 
Merged from trunk

12 years agoPolished source code.
Alex Rousskov [Thu, 3 Oct 2013 18:25:05 +0000 (12:25 -0600)] 
Polished source code.

12 years agoCheck whether there is another license _after_ we removed an old boilerplate
Alex Rousskov [Thu, 3 Oct 2013 18:21:21 +0000 (12:21 -0600)] 
Check whether there is another license _after_ we removed an old boilerplate
and skip such files as special cases.

12 years agoAdded a boilerplate to allow scripts/boiler-mgr.pl to update it automatically.
The Squid Software Foundation [Thu, 3 Oct 2013 17:33:14 +0000 (11:33 -0600)] 
Added a boilerplate to allow scripts/boiler-mgr.pl to update it automatically.

12 years agoRestricted script scope to boiler management. Polished description.
The Squid Software Foundation [Thu, 3 Oct 2013 17:28:29 +0000 (11:28 -0600)] 
Restricted script scope to boiler management. Polished description.

12 years agoHandle more rare cases and polish.
The Squid Software Foundation [Thu, 3 Oct 2013 17:11:30 +0000 (11:11 -0600)] 
Handle more rare cases and polish.

Detect more suspected licenses in unusual locations. Do not warn when
adding a new boilerplate to reduce WARNING noise.

Report (C) claims to stdout, separately from the WARNINGs stream on stderr.

Improved whitespace handling.

12 years agoMore ~pPrep for 3.4.0.2
Amos Jeffries [Thu, 3 Oct 2013 12:30:26 +0000 (06:30 -0600)] 
More ~pPrep for 3.4.0.2

12 years agoPrep for 3.4.0.2
Amos Jeffries [Thu, 3 Oct 2013 12:17:18 +0000 (06:17 -0600)] 
Prep for 3.4.0.2

12 years agoFixed detection of various custom lines around "numerous individuals" boilers.
The Squid Software Foundation [Thu, 3 Oct 2013 05:47:53 +0000 (23:47 -0600)] 
Fixed detection of various custom lines around "numerous individuals" boilers.

Recognize more custom lines inside boilerplates.

Recognize multi-author lines with a single AUTHOR prefix. Split multi-author
claims (does not fully work in a few some complex cases, but that is OK).
Cleaned up reported claims a little.

Preserve "inspired by" comments when replacing their home boilerplates.

12 years agoAdjusted unusual boilerplates to allow scripts/source-mangler.pl to update them
Alex Rousskov [Thu, 3 Oct 2013 00:17:12 +0000 (18:17 -0600)] 
Adjusted unusual boilerplates to allow scripts/source-mangler.pl to update them
automatically.

The script tries to be extra careful and skips what it feels may be a custom
boilerplate that requires a manual intervention. The cases handled by this
commit are simple, non-controversial ones.

12 years agoHandle all common boilerplate cases in src/,
The Squid Software Foundation [Wed, 2 Oct 2013 23:57:48 +0000 (17:57 -0600)] 
Handle all common boilerplate cases in src/,
leaving about a dozen known exceptions.

Report copyright-related claims if a recognized boilerplate containing them is
going to be replaced with a standard one. These claims should then be cross
referenced with CONTRIBUTORS and CREDITS, updating those files if needed.
Boilerplates should not contain variable information, such as individual
copyright claims.

Leave DEBUG section information as a separate comment.

Improved error reporting.

12 years agoAdd --disable-arch-native build option
Amos Jeffries [Wed, 2 Oct 2013 12:21:20 +0000 (06:21 -0600)] 
Add --disable-arch-native build option

The -march-native option is required by Clang 3.2 on some CPU
and produces better optimization in binaries by GCC.
But building inside a virtual machine environment has been found to
cause random Illegal Instruction errors due to mis-detection of CPU.

This option is added to permit selective disabling of teh preferred
default (which is to use the compiler flag when available).

12 years agoFix line wrapping broken in rev.13027
Amos Jeffries [Wed, 2 Oct 2013 09:51:09 +0000 (03:51 -0600)] 
Fix line wrapping broken in rev.13027

12 years agoFix some missing parts from 13015
Amos Jeffries [Wed, 2 Oct 2013 09:06:03 +0000 (03:06 -0600)] 
Fix some missing parts from 13015

The %LOGIN format code makes the regressino testign fail minimal builds
where auth is disabled.

The test-suite configuration tests need to be distributed to allow
make check to operate outside a repository checkout.

12 years agoFix build errors in rev.13012
Amos Jeffries [Wed, 2 Oct 2013 03:41:06 +0000 (21:41 -0600)] 
Fix build errors in rev.13012

static functions defined in headers (.h) must be used in all .cc which
include them. Functions which are not always used must be defined as
inline instead.

This resolves warning: 'const char* LogTime()' defined but not used

12 years agoA script to add or update C/C++ boilerplate.
The Squid Software Foundation [Wed, 2 Oct 2013 01:21:11 +0000 (19:21 -0600)] 
A script to add or update C/C++ boilerplate.

Needs more work to handle more common cases.

12 years agoInitial changes to streamline copyright declarations in Squid sources
Alex Rousskov [Wed, 2 Oct 2013 01:12:35 +0000 (19:12 -0600)] 
Initial changes to streamline copyright declarations in Squid sources
and related metafiles. No functionality or licensing changes are intended.

Once completed, the changes will consistently declare Squid contributors
(listed in CONTRIBUTORS and represented by the Squid Software Foundation) as
Squid copyright owners while referring the reader to the COPYING file for GPL
licensing details. The boilerplate with the above information is provided.

These changes do not affect copyright rights of individuals or organizations.
We are simply confirming the fact that there are many Squid copyright owners,
just like there are many Linux kernel copyright owners. We are also providing
a simple, consistent way to document that fact.

In this particular commit:

* Enlarged CONTRIBUTORS file scope to include all Squid code contributors, not
  just individual volunteers. Added known organizations that contributed Squid
  code. We could have two separate files for individuals and organizations,
  but there is probably no difference between the two as far as copyright is
  concerned so why complicate things?

  Ideally, it would be best to isolate non-code contributors (or, to be more
  precise, contributors without copyright claims) from the rest of the group,
  but doing so is impractical at this point IMHO. We do not state that all
  listed contributors have a copyright claim on Squid so our statements remain
  correct, albeit not precise.

* Fixed SPONSOR[.list] scope to include those who funded development. The
  file entries already included many such sponsors but the preamble excluded
  them. If some of those sponsors retained copyright for the developed code,
  they should be also listed in the CONTRIBUTORS file. More work is probably
  needed to make the latter true as I could only audit entries I know about.

* Explicitly defined CREDITS file scope. Removed Squid copyright/licensing
  statement from that file as out of scope (parts of it belong to README,
  COPYING, and boilerplates). Polished Harvest/cached entry description,
  removing no longer valid URL (that is still mentioned in the Harvest
  license, which is preserved "as is", of course).

* Removed COPYRIGHT file. It was very stale, non standard (GNU uses COPYING),
  and inaccurate. The Regents of the University of California, a rightful
  Squid co-owner have been moved to the CONTRIBUTORS file. Historical facts
  about UCSD and NSF NLANR grants is already available in the SPONSORS file.

* Updated README with the standard boilerplate text. That file needs more
  polishing work outside this project scope.

* Fixed custom scripts/formater.pl boilerplate.

12 years agoSourceFormat Enforcement
Automatic source maintenance [Wed, 2 Oct 2013 00:12:54 +0000 (18:12 -0600)] 
SourceFormat Enforcement

12 years agoRemove dnsserver and external DNS helper API
Amos Jeffries [Tue, 1 Oct 2013 23:21:17 +0000 (17:21 -0600)] 
Remove dnsserver and external DNS helper API

The external DNS helper API places limits on Squid DNS lookups per second
low enough to noticably affect the HTTP requests per second which can be
served.

Request for comments about proposed removal 2 years ago produced feedback
stating that the helper was needed for local name resolution. This is
now available since 3.4 mDNS extensions.

A more recent request for reasons for keeping the helper API have
produced only two responses over the period of several months. Both
indicating that the API is no longer necessary for the business cases of
a year or so ago.

As such and because the helper fails to operate sufficiently on several
major operating systems and the API is difficult to maintain it is being
removed as of Squid-3.5.

12 years agoRemove COSS
Amos Jeffries [Mon, 30 Sep 2013 12:30:50 +0000 (06:30 -0600)] 
Remove COSS

This storage type has been superceded by Rock storage since 3.2.

12 years agoPolish: better WARNING when workers directive is ignore on reconfigure.
Amos Jeffries [Mon, 30 Sep 2013 07:22:17 +0000 (01:22 -0600)] 
Polish: better WARNING when workers directive is ignore on reconfigure.

Changing the workers directive requires a proxy restart, not just a
reconfigure. State this clearly in the warning message.

12 years agoTests: Add regression tests for squid.conf parser
Amos Jeffries [Mon, 30 Sep 2013 07:04:36 +0000 (01:04 -0600)] 
Tests: Add regression tests for squid.conf parser

Regressions identified by the community in active production configs
with the 3.4.0.1 parser upgrade attempt.

Also, disables %macro detection inside quoted-strings. Which is still
encountering errors in the current 3.HEAD code.

12 years agoSourceFormat Enforcement
Automatic source maintenance [Mon, 30 Sep 2013 00:14:45 +0000 (18:14 -0600)] 
SourceFormat Enforcement

12 years agoFix various header build issues in librfcnb
Amos Jeffries [Sun, 29 Sep 2013 20:14:10 +0000 (14:14 -0600)] 
Fix various header build issues in librfcnb

Highlighted when the #include sorting was applied to lib/rfcnb/ files
several of the headers were using order-dependent definitions and were
not wrapped with sfety macros.

12 years agoChinese language dialect updates
Amos Jeffries [Sun, 29 Sep 2013 18:37:10 +0000 (06:37 +1200)] 
Chinese language dialect updates

Perform the long overdue renaming of zh-cn.po an zh-tw.po to Hans and
Hant alphabet files. Add aliases for the 2 and 3 code dialect tags which
are appearing in Asian traffic.

12 years agoFix various compile errors in rev.13012
Amos Jeffries [Sat, 28 Sep 2013 15:19:53 +0000 (03:19 +1200)] 
Fix various compile errors in rev.13012

Uncovered by GCC 4.8 and Squid Project build farm testing.

12 years agoAdd missing integration of squid.conf test with Unit-Test PASS/FAIL results
Amos Jeffries [Sat, 28 Sep 2013 09:14:43 +0000 (03:14 -0600)] 
Add missing integration of squid.conf test with Unit-Test PASS/FAIL results

12 years agoAutomated squid.conf parser testing with squid -k parse
Amos Jeffries [Sat, 28 Sep 2013 09:01:23 +0000 (03:01 -0600)] 
Automated squid.conf parser testing with squid -k parse

This make the build process testing run 'squid -k parse' with a series
of test configuration files to exercise edge cases and backward
compatibility.

The default squid.conf which is to be installed on new systems is always
tested.

Other config files with unit tests can be dropped into
test-suite/squidconf/ and will be parse tested automatically.

12 years agotypo in rev.13013
Amos Jeffries [Fri, 27 Sep 2013 16:14:40 +0000 (10:14 -0600)] 
typo in rev.13013

12 years agoPortability: cleanup includes for sys/time.h and sys/resource.h
Amos Jeffries [Fri, 27 Sep 2013 16:06:15 +0000 (10:06 -0600)] 
Portability: cleanup includes for sys/time.h and sys/resource.h

These two include files are order-dependent on several operating systems
and as such are provided by Squid libcompat headers. There is no need for
code to include them specially and several HAVE_SYS_TIME_H macros were
missing which breaks the build on systems where the file is missing.

12 years agonegotiate_kerberos_auth: upgrade to present group= keys
Markus Moeller [Fri, 27 Sep 2013 15:21:54 +0000 (09:21 -0600)] 
negotiate_kerberos_auth: upgrade to present group= keys

Use the new kv-pair protocol extensions for emitting group details
directly at the time of authentication. group=X key-value pair is
used to emit the Kerberos SIDS values presented by MS Active
Directory environments.

Also, update the Hiemdal library support for recent library versions.

Also, polish the Kerberos and LDAP Group related code to avoid memory
leaks and improve C++ coding style.

12 years agoUse IPv6 localhost nameserver on DNS configuration errors
Amos Jeffries [Tue, 24 Sep 2013 14:19:08 +0000 (08:19 -0600)] 
Use IPv6 localhost nameserver on DNS configuration errors

When DNS configuration fails to locate a set of nameservers "localhost"
is used as the default but has previously only been setting 127.0.0.1
IPv4 address for localhost. This enables the failover to work as designed
on IPv6-only networks.

12 years agoBug 3914: partial: make squidclient tool build cleanly with -Wconversion
Amos Jeffries [Sat, 21 Sep 2013 17:21:48 +0000 (05:21 +1200)] 
Bug 3914: partial: make squidclient tool build cleanly with -Wconversion

12 years agoBug 3923: cbdata and undefined behavior due to dynamic runtime enumeration
'noloader' [Sat, 21 Sep 2013 14:19:37 +0000 (02:19 +1200)] 
Bug 3923: cbdata and undefined behavior due to dynamic runtime enumeration

12 years agoBug 3918: Squid 3.3.9 Self Test Failures on Mac OS X 10.8
Alex Rousskov [Sat, 21 Sep 2013 12:33:29 +0000 (00:33 +1200)] 
Bug 3918: Squid 3.3.9 Self Test Failures on Mac OS X 10.8

12 years agoBug 3929: request_header_add not working for tunnel requests
libit [Sat, 21 Sep 2013 12:23:23 +0000 (00:23 +1200)] 
Bug 3929: request_header_add not working for tunnel requests

12 years agoFix typo in rev.13004
Amos Jeffries [Sat, 21 Sep 2013 12:13:36 +0000 (00:13 +1200)] 
Fix typo in rev.13004

12 years agoPolish: report bytes received when bad content-length detected by quick-abort
Amos Jeffries [Fri, 20 Sep 2013 02:41:05 +0000 (14:41 +1200)] 
Polish: report bytes received when bad content-length detected by quick-abort

12 years agoFixed documentation, tentative alternate dump implementation with Raw api
Francesco Chemolli [Thu, 19 Sep 2013 12:38:58 +0000 (14:38 +0200)] 
Fixed documentation, tentative alternate dump implementation with Raw api
Improve SBuf::find readability
Improved readability and error reporting in SBuf
Fixed nonfatal bug in snprintf behavior detection

12 years agoFix pinning hierarchy log information
Amos Jeffries [Wed, 11 Sep 2013 11:33:20 +0000 (05:33 -0600)] 
Fix pinning hierarchy log information

12 years agoPrep for 3.3.9
Amos Jeffries [Wed, 11 Sep 2013 01:31:14 +0000 (19:31 -0600)] 
Prep for 3.3.9

12 years agoWindows: locate CMSG definitions in Winsock2.h when present
Amos Jeffries [Sun, 8 Sep 2013 22:26:49 +0000 (16:26 -0600)] 
Windows: locate CMSG definitions in Winsock2.h when present

Windows defines the CMSG macros in Winsock2.h sometimes. This allows the
definitions there to be used when present and avoids compiler errors
about double definitions.

  This is an iCelero project.

12 years agoBug 3849: Duplicate certificate sent when using https_port
Christos Tsantilas [Sun, 8 Sep 2013 10:48:51 +0000 (13:48 +0300)] 
Bug 3849: Duplicate certificate sent when using https_port

The certificate file given with the "cert=" option it may contain a list of
certificates to be chained to the SSL client, for example intermediate
certificates.
The bug caused because in the certificates  chain we are storing also the
certificate of the port. This is works well for SSL-bump because squid
generates a certificate which uses the port certificate as CA certificate.
But in the case of https_port without bumping the port certificate is sent
twice, one as SSL server certificate and one as chained certificate.

This patch try to chain port certificate only when the sslbump is used.

This is a Measurement Factory project

12 years agoFix myportname ACL on ICAP/eCAP transactions
Amos Jeffries [Sun, 8 Sep 2013 04:27:31 +0000 (22:27 -0600)] 
Fix myportname ACL on ICAP/eCAP transactions

The port name from http_port/https_port was not being propigated to
adapted reqeusts after ICAP/eCAP. Which makes the myportname ACL and
logging of portname not work on adapted requests.

 This is an iCelero Project

12 years agoDocs: Update SPONSORS listing
Amos Jeffries [Sun, 8 Sep 2013 04:02:54 +0000 (22:02 -0600)] 
Docs: Update SPONSORS listing

12 years agoWindows: document the purpose and use of Squid namespace wrappers
Amos Jeffries [Sun, 8 Sep 2013 03:17:25 +0000 (21:17 -0600)] 
Windows: document the purpose and use of Squid namespace wrappers

Also, add some missing #define's

  This is an iCelero project

12 years agoWindows: fix IPv6 split-stack support
Amos Jeffries [Sun, 8 Sep 2013 03:07:29 +0000 (21:07 -0600)] 
Windows: fix IPv6 split-stack support

Some builds of MinGW do not define IPV6_V6ONLY socket option.

  This is an iCelero project

12 years agoWindows: fix collision between POSIX wrappers and DiskIO class methods
Amos Jeffries [Tue, 3 Sep 2013 09:05:02 +0000 (21:05 +1200)] 
Windows: fix collision between POSIX wrappers and DiskIO class methods

The POSIX function shutdown() is #define'd on Windows. This causes
compiler issues with the DiskIO method of same name. Rename the method
to gracefulShutdown() instead.

Also, Bug 3189 was incomplete and missed a change to DiskThreads
Windows initialization method.

  This is an iCelero project.

12 years agoRegression fix: revert rev.12815 MinGW C++11 support
Amos Jeffries [Tue, 3 Sep 2013 00:16:54 +0000 (12:16 +1200)] 
Regression fix: revert rev.12815 MinGW C++11 support

MinGW supports c++11 but in ANSI-strict way. Squid code still contains
non-standard strcasecmp strncasecmp and possibly other functions.

  This is a iCelero Project.

12 years agoPolish: typo in debug for SSL-bumping
John Xue [Mon, 2 Sep 2013 04:17:48 +0000 (22:17 -0600)] 
Polish: typo in debug for SSL-bumping

12 years agoProperly log pinned connection destination (%<A).
Alex Rousskov [Sat, 31 Aug 2013 23:10:46 +0000 (17:10 -0600)] 
Properly log pinned connection destination (%<A).

Same as Amos' pinning_hier_note.patch

12 years agoProhibit FTP PORT destinations other than the control connection source IP.
Alex Rousskov [Sat, 31 Aug 2013 18:34:01 +0000 (12:34 -0600)] 
Prohibit FTP PORT destinations other than the control connection source IP.

12 years agoRequire passive FTP gw connections to come from the control connection src IP.
Alex Rousskov [Sat, 31 Aug 2013 01:32:28 +0000 (19:32 -0600)] 
Require passive FTP gw connections to come from the control connection src IP.

Ignore rogue attempts at stealing data connection from legitimate users.

Fixed on-error data connection closing code. On some errors, closed data
connection metadata was left in inconsistent state. After that, RETR/etc.
commands resulted in Squid trying to open an active data connection using
old data connection port info, leading to commBind errors.

12 years agoUse ftp_port as "my port" if there are no http[s]_ports configured.
Alex Rousskov [Fri, 30 Aug 2013 16:36:30 +0000 (10:36 -0600)] 
Use ftp_port as "my port" if there are no http[s]_ports configured.

12 years agoAllow changing the FTP user name and destination via repeated USER commands.
Alex Rousskov [Fri, 30 Aug 2013 16:24:32 +0000 (10:24 -0600)] 
Allow changing the FTP user name and destination via repeated USER commands.

When the user or destination change, Squid closes client data connection,
and server control connection (if any).

12 years agoDisclaim support for all FTP AUTH commands,
Alex Rousskov [Fri, 30 Aug 2013 04:57:44 +0000 (22:57 -0600)] 
Disclaim support for all FTP AUTH commands,
even though some rare ones might work.

Documented reasons for disclaiming support.

12 years ago<set> (declaring just added std::set) should be #included explicitly.
Alex Rousskov [Fri, 30 Aug 2013 04:43:09 +0000 (22:43 -0600)] 
<set> (declaring just added std::set) should be #included explicitly.

12 years agoTo minimize TCP races, delay complaining about missing passive data connection
Alex Rousskov [Thu, 29 Aug 2013 23:48:21 +0000 (17:48 -0600)] 
To minimize TCP races, delay complaining about missing passive data connection
to Squid until we talk to the server.

After PASV, it is possible for the client TCP handshake to reach Squid _after_
a LIST or RETR command is parsed, even if the client properly initiates the
connection before writing the command. We no longer immediately respond with
425 "Data connection is not established" in such cases, but re-check the data
connection availability after we talk to the server.

Also polished/fixed a few comments.

12 years agoDisclaim support for FTP EPRT and EPSV commands. Exclude them from FEAT
Alex Rousskov [Thu, 29 Aug 2013 16:38:39 +0000 (10:38 -0600)] 
Disclaim support for FTP EPRT and EPSV commands. Exclude them from FEAT
responses.

Squid still assumes that it can support all other FTP commands.

TODO: We probably want to add ftp_support or a similar ACL-driven option
to give admin more control over which commands are supported. This is
different from access control because we want to filter unsupported
commands from FEAT responses as well.

12 years agoAdded Expect:100-continue to FTP STOR wrappers for adaptation to avoid stalling
Alex Rousskov [Thu, 29 Aug 2013 14:21:09 +0000 (08:21 -0600)] 
Added Expect:100-continue to FTP STOR wrappers for adaptation to avoid stalling
FTP clients that expect an FTP 150 (OK to send data) response from the FTP
server before actually uploading content.

If an adaptation service starts waiting for the PUT request body before
starting to produce an adaptation response (allowing the transaction to reach
the FTP server), the FTP transaction will get stuck. It is not clear why this
has not been a [known] issue with real HTTP requests containing
Expect:100-continue.

12 years agoFix configuration file parsing bugs, related to quoted strings
Christos Tsantilas [Thu, 29 Aug 2013 10:22:43 +0000 (13:22 +0300)] 
Fix configuration file parsing bugs, related to quoted strings

Try to fix 'comparison between signed and unsigned integer expression' compiler
warning.

12 years agoFix configuration file parsing bugs, related to quoted strings
Christos Tsantilas [Thu, 29 Aug 2013 09:21:53 +0000 (12:21 +0300)] 
Fix configuration file parsing bugs, related to quoted strings

This is patch try to fix problems discussed under the "[PATCH] Unknown cfg function"
mail thread on squid-dev mailing list

Fixes/changes:
 - The quoted tokens mode (configuration_includes_quoted_values parameter)
   is  set to off by default

 - If configuration_includes_quoted_values is off the quoted tokens
   parsed using the ConfigParser::NextToken include the quotes, to keep
   compatibility with older releases.

 - The methods ConfigParser::RegexPattern() and ConfigParser::RegexStrtokFile()
   added to parse regex tokens. The regex tokens can not be quoted values but
   have their own syntax.

 - For the cases where quoted strings are required (wordlists, Notes
   parsing, Headers with acl), the new ConfigParser::NextQuotedToken method
   added.
   The old wordlists parser allowed escaping any character, this patch
   will return an error if you try to escape alphanumeric characters. The
   \r \n and \t have the C semantics.

 - Removes the ConfigParser::TokenUndo method. The new method
   ConfigParser::NextTokenPreview() which can be used to preview the next
   token is added. This method if the next token is invalid (eg unquoted
   with special characters) instead of calling self_destruct it will return
   the "[invalid token]" as token.

 - A set of new flags defined under ConfigParser class to define the type of
   parsing: ParseRegex_ (next token is regex)  ParseQuotedOrToEOL_
   (next token is quoted or to-EOL), PreviewMode_ (just do preview do not
   pop next token)

 - Currently parser read a line, and the tokens stored on this line
   and the line modified while parsed.
   This patch extracts the tokens from line and store them to
   ConfigParser::CfgLineTokens_ member. This method selected because
     1) We may need to parse again the line so we do not want to modify it.
        For example call the ConfigParser::PeekAtToken method to check if it
        is a flag token ( eg "-i"), and if not call the
        ConfigParser::RegexPattern() method to read next regex expression.
     2) The current line tokens must stored somewhere to support the following:
        char *name = ConfigParser::NextToken();
        char *value = ConfigParser::NextToken();
   The ConfigParser::CfgLineTokens_ reset when a new config line is read.

TODO:
 - The ConfigParser::TokenPutBack method probably should removed in the future
   together with the ConfigParser::Undo_ and ConfigParser::Undo().
   This method is currently used only in one place (acl regex).

12 years agoReorganized FTP response storage/wrapping to fix multi-line response gatewaying
Alex Rousskov [Thu, 29 Aug 2013 00:15:55 +0000 (18:15 -0600)] 
Reorganized FTP response storage/wrapping to fix multi-line response gatewaying

Multi-line FTP control responses use various line prefixes to tell the client
that the response continues to the next line. Some multi-line responses use a
"CODE-" line prefix. Some, like FEAT, must use a single space as a line prefix
(except for the first line that uses "CODE-"). Squid was removing the virgin
prefix and then using "CODE-" prefix for all lines, breaking FEAT and probably
other responses.

While modifying original multi-line prefix was a bad idea, leaving FTP
multi-lines "as is" does not work either because HTTP wrapping removes leading
spaces which are significant in FEAT and other FTP responses.

Squid now preserves leading multi-lines by wrapping them using quoted strings.
Adaptation services wishing to interpret multi-lines must unquote any quoted
FTP-* header field values before adaptation and return quoted values back (if
needed).  Which FTP-* header values are quoted and which are not may be
value-dependent and may change. Quoting and unquoting requires handling of
HTTP \-CHAR escape sequences.

The last FTP response line has to be treated specially because it has [more]
strict syntax, has to be interpreted by Squid, subjected to squid.conf ACLs,
and is more likely to be adapted. Squid used to wrap all multi-lines into
multiple fields of an FTP-Reason header while only storing the "reason" from
the last multi-line there. That was messy, and became prohibitively so when
multi-line quoting of multi-lines was introduced.

Now Squid wraps all multi-lines except the last one using FTP-Pre header.  All
FTP-Pre lines may be wrapped as quoted strings. FTP-Status and FTP-Reason
headers are used for the FTP code and reason phrase from the last line:

  FTP-Pre: "123-first line"
  FTP-Pre: " second line"
  FTP-Status: 123
  FTP-Reason: from the third line

Needs more work if there are adaptation services that merge multiple FTP-Pre
header values together.

12 years agoAdded httpHeaderQuoteString() to quote strings using HTTP rules.
Alex Rousskov [Wed, 28 Aug 2013 23:21:45 +0000 (17:21 -0600)] 
Added httpHeaderQuoteString() to quote strings using HTTP rules.

12 years agoPrevent "found KEY_PRIVATE" WARNINGs by releasing FTP gw store entries.
Alex Rousskov [Tue, 27 Aug 2013 21:53:40 +0000 (15:53 -0600)] 
Prevent "found KEY_PRIVATE" WARNINGs by releasing FTP gw store entries.

12 years agoUse more portable 227 (PASV) response format.
Alex Rousskov [Tue, 27 Aug 2013 16:47:55 +0000 (10:47 -0600)] 
Use more portable 227 (PASV) response format.

RFC1123 says that "The format of the 227 reply to a PASV command is not well
standardized". Evidently, we should not use "227 =a,b,c,d,p1,p2" or
"227 Entering Passive Mode. A1,A2,A3,A4,a1,a2" formats. Some nf_ct_ftp
versions block responses that use those alternative syntax rules!

12 years agoImproved FTP error handling and reporting.
Alex Rousskov [Tue, 27 Aug 2013 16:19:20 +0000 (10:19 -0600)] 
Improved FTP error handling and reporting.

Use FTP 451 response if we intend to keep the control connection open.
Use FTP 421 response if we intend to close the control connection.  Some
FTP clients close the control connection upon receiving a 421 response.

Report more error details in FTP_ERROR state (FtpHandleErrorReply) by moving
common error reporting code from FtpWriteForwardedForeign into
FtpWriteErrorReply.

12 years agoMerged from trunk r12948.
Alex Rousskov [Tue, 27 Aug 2013 15:45:11 +0000 (09:45 -0600)] 
Merged from trunk r12948.

12 years agoMarked where HDR_FTP_ARGUMENTS for FTP gw PASS may need to be hidden.
Alex Rousskov [Mon, 26 Aug 2013 22:43:42 +0000 (16:43 -0600)] 
Marked where HDR_FTP_ARGUMENTS for FTP gw PASS may need to be hidden.

12 years agoFixed logging of HTTP reply [wrapper] sent to FTP clients.
Alex Rousskov [Mon, 26 Aug 2013 22:23:32 +0000 (16:23 -0600)] 
Fixed logging of HTTP reply [wrapper] sent to FTP clients.

Simplified and documented FtpWriteEarlyReply() and related code.

12 years agoLog %<sS (reply content length) as zero when object size is unknown.
Alex Rousskov [Mon, 26 Aug 2013 19:15:21 +0000 (13:15 -0600)] 
Log %<sS (reply content length) as zero when object size is unknown.

For %<sS purposes, Squid computes reply content length as the difference
between "object size" and response headers. When headers were received but the
"object size" is not known (e.g., the promissed response body was never
received), that computation results in misleading negative numbers. We no
longer log them.

12 years agoSupport %<st and %<sh logformat codes for FTP gateway responses.
Alex Rousskov [Mon, 26 Aug 2013 19:09:40 +0000 (13:09 -0600)] 
Support %<st and %<sh logformat codes for FTP gateway responses.

For logging purposes, treat all non-data FTP responses (i.e., bytes written on
the client control connection) as "HTTP headers" because they are similar
"matadata".

12 years agoAdded ftp_client_idle_timeout directive to squid.conf.
Alex Rousskov [Mon, 26 Aug 2013 18:24:02 +0000 (12:24 -0600)] 
Added ftp_client_idle_timeout directive to squid.conf.

Many FTP clients do not deal with control connection closures. They cannot
retry pconn races without asking the user for credentials, for example.  Thus,
the existing client_idle_pconn_timeout default (2 minutes) does not work well
for FTP clients. One the other hand, increasing that may create too many idle
HTTP connections for Squid to maintain.

The new timeout is specific to ftp_port traffic. It does not affect ftp://...
requests sent to an http[s]_port.

12 years agoDo not close FTP gw server control connection on more server-unrelated errors.
Alex Rousskov [Mon, 26 Aug 2013 17:46:48 +0000 (11:46 -0600)] 
Do not close FTP gw server control connection on more server-unrelated errors.

FtpGatewayServer now forgets about its control connection to the server once
it is done communicating with that server. This allows us to preserve that
connection on FTP transaction errors (e.g., forbidden responses or broken
ICAP servers) that are not related to the server communication and can be
ignored as far as the next FTP gatewayed transaction is concerned.

Removed special DONE state because it is now identical to doneWithServer().

Fixed ServerChannel::forget() to prevent subsequent forgotten connection
closure.

12 years agoDocs: fix doxygen page generation
Amos Jeffries [Mon, 26 Aug 2013 11:14:58 +0000 (05:14 -0600)] 
Docs: fix doxygen page generation

12 years agoWindows: fix getopt.c build error with MinGW
Amos Jeffries [Mon, 26 Aug 2013 10:01:53 +0000 (04:01 -0600)] 
Windows: fix getopt.c build error with MinGW

Resolve warning 'initialization discards const qualifieer from pointer'.

  This is an iCelero project.

12 years agoSourceFormat Enforcement
Automatic source maintenance [Mon, 26 Aug 2013 00:12:21 +0000 (18:12 -0600)] 
SourceFormat Enforcement

12 years agoAvoid some unnecessary FTP control connection closures; polished FTP failure
Alex Rousskov [Sun, 25 Aug 2013 19:50:44 +0000 (13:50 -0600)] 
Avoid some unnecessary FTP control connection closures; polished FTP failure
code.

Do not close FTP server control connection just because FTP response
adaptation is done. We still close FTP connections if we are receiving the
virgin response (because we have no place to store it), but if we are done
receiving, there is no need to terminate FTP server connections. The former
happens when an ICAP service responds before receiving the entire virgin FTP
response. The latter, when the ICAP service responds after the FTP data
connection is closed but before the control 226 response comes in.

Do not close FTP client control connection just because we served a non-OK
control response. The client may still send us commands if our ClientStream is
still in a good state. This may happen when an FTP download is prohibited by
an adaptation service via an HTTP 403 Forbidden response, for example.

Avoid STORE_PENDING assertion in FwdState::reforward() due to double
forwarding completion by FtpGatewayServer. Similar code exists in regular FTP
server and is needed for gatewaying as well because FTP may keep open (and
expect a control response on) the control connection after adaptation is
completed, creating two avenues for a FwdState::complete() call.

Ftp::ServerStateData::failed() should always call FwdState::fail(), to supply
forwarding code with ErrorState details. And we should not create the error
HttpReply in the FTP code. FwdState code does that, probably because it may
reforward the request and, hence, bypass some errors. For now, FTP gateway
code still creates an HttpReply (in addition to calling FwdState::fail) to be
able to supply custom gatewaying error information. Eventually, that should be
done via custom ErrorState object (that will later create an appropriate
HttpReply when/if needed).

Added debugging.

12 years agoImproved compatibility with clang and icc
Francesco Chemolli [Sun, 25 Aug 2013 06:36:13 +0000 (08:36 +0200)] 
Improved compatibility with clang and icc

12 years agoDoce: make doc/Programming-Guide/doxygen.footer.dyn non-empty
Amos Jeffries [Sun, 25 Aug 2013 04:44:20 +0000 (22:44 -0600)] 
Doce: make doc/Programming-Guide/doxygen.footer.dyn non-empty

Experiment to see if the .dyn file footer output by doxygen is still
placed if this file contains whitespace. Just having it empty no longer
seems to work with the newer doxygen version.

12 years agoDocs: define use of footer for output DYN files.
Amos Jeffries [Sat, 24 Aug 2013 13:12:26 +0000 (01:12 +1200)] 
Docs: define use of footer for output DYN files.

doc/Programming-Guide/doxygen.footer.dyn is an empty file because we do
not need anythign as a footer. But we do need to use it because doing so
will suppress teh default "</body></html>" string being appended to the
output file, which breaks out static site generation since .dyn files
have our own squid-cache.org footers automatically appended.

12 years agoBug 3895: fix acl_uses_indirect_client and cache_peer_access
David Isaacs [Sat, 24 Aug 2013 06:24:07 +0000 (00:24 -0600)] 
Bug 3895: fix acl_uses_indirect_client and cache_peer_access

12 years agoAvoid segfaults when RETR is not preceded by PORT or PASV.
Alex Rousskov [Fri, 23 Aug 2013 23:34:28 +0000 (17:34 -0600)] 
Avoid segfaults when RETR is not preceded by PORT or PASV.

Polished code.

12 years agoRender adaptation X-Response-Info and X-Response-Desc meta values in FTP errors
Alex Rousskov [Fri, 23 Aug 2013 22:19:46 +0000 (16:19 -0600)] 
Render adaptation X-Response-Info and X-Response-Desc meta values in FTP errors
caused by adaptation (e.g., an ICAP service blocking an FTP command)

Requires adaptation history to be enabled, which can be achieved by logging
adaptation meta headers to access log (%adapt::<last_h) or setting
adaptation_masterx_shared_names in squid.conf

Long term, the contents of the error message should be configurable via
error message templates (which may include these semi-standard meta headers).

12 years agoWhen writing FTP errors to the client, omit ERR_NONE error name.
Alex Rousskov [Fri, 23 Aug 2013 21:28:11 +0000 (15:28 -0600)] 
When writing FTP errors to the client, omit ERR_NONE error name.

12 years agoProvide user with more details on forwarding/adaptation errors.
Alex Rousskov [Fri, 23 Aug 2013 20:29:04 +0000 (14:29 -0600)] 
Provide user with more details on forwarding/adaptation errors.

In addition to "421 Service Unavailable", print %c and %E errorpage info.
Needs more work to make FTP error messages configurable, just like they are
for HTTP.

12 years agoFixed client_side.cc "context->socketState() == STREAM_COMPLETE" assertion
Alex Rousskov [Fri, 23 Aug 2013 17:52:12 +0000 (11:52 -0600)] 
Fixed client_side.cc "context->socketState() == STREAM_COMPLETE" assertion
on client-aborted downloads.

Improved debugging.

12 years agoUse the _last_ @ to find the end of the FTP USER name
Alex Rousskov [Fri, 23 Aug 2013 02:08:53 +0000 (20:08 -0600)] 
Use the _last_ @ to find the end of the FTP USER name
(and the start of the FTP server host name).

12 years agoInitial support for active FTP downloads via the FTP PORT command.
Alex Rousskov [Fri, 23 Aug 2013 01:20:21 +0000 (19:20 -0600)] 
Initial support for active FTP downloads via the FTP PORT command.

Squid accepts PORT command on the client side, but still uses passive transfer
on the server side. The PORT command response is not sent to the client until
the server-side PASV command succeeds. The data connection to the client is
not opened until Squid receives the RETR command from the client.

Squid requires either PORT or PASV command before data transfers. RFC 959 says
PORT is optional because default ports can be used.

RFC 959 also seems to imply that Squid should originate active connections to
client from port 20.  The code to do that is commented out for now because it
would prevent support for concurrent data connections. The code configuring
this outgoing (but to-client) connection may need more work as we do a lot
more for outgoing to-server connections.

Active data upload has not been tested.

12 years agoClose idle client connections associated with closed idle pinned connections.
Alex Rousskov [Thu, 22 Aug 2013 18:39:41 +0000 (12:39 -0600)] 
Close idle client connections associated with closed idle pinned connections.

Squid was not monitoring idle persistent connections pinned to servers. Squid
would discover that the pinned server connection is closed only after
receiving a new request on the idle client connection and trying to write that
request to the server. In such cases, Squid propagates the pinned connection
closure to the client (as it should).

Chrome and, to a lesser extent, Firefox handle such races by opening a new
connection and resending the failed [idempotent] request transparently to the
user. However, IE usually displays an error page to the user.

While some pconn races cannot be avoided, without monitoring idle pconns,
Squid virtually guaranteed such a race in environments where origin server
idle connection timeout is smaller than client/Squid timeouts and users
are revisiting pages in the window between those two timeouts.

Squid now monitors idle pinned connections similar to idle connections in the
pconn pool and closes the corresponding idle client connection to keep the two
sides in sync (to the extent possible).

It is theoretically possible that this change will break servers that send
whitespace on an idle persistent connection or perhaps send some SSL keepalive
traffic. No such cases are known to exist though.

12 years agoFixed address handling for PASV responses in interception cases.
Alex Rousskov [Wed, 21 Aug 2013 15:39:09 +0000 (09:39 -0600)] 
Fixed address handling for PASV responses in interception cases.

Added debugging, comments.

12 years agoWindows: Fix ConnOpener::sleep() collision with global macro
Amos Jeffries [Wed, 21 Aug 2013 11:26:14 +0000 (05:26 -0600)] 
Windows: Fix ConnOpener::sleep() collision with global macro

Squid compat library defines sleep() as a wrapper macro which
collides with the member definition in Comm::ConnOpener.

 This is an iCelero project

12 years agoUpdate forward_max_tries to permit 25 server paths
Amos Jeffries [Wed, 21 Aug 2013 08:43:27 +0000 (02:43 -0600)] 
Update forward_max_tries to permit 25 server paths

With cloud sites becoming more popular more CDN servers are producing
long lists of IPv6 and IPv4 addresses. If there are not enough paths
selected the IPv4 ones may never be reached.

12 years agoShow number of available filedescriptors when reserved FD changes
Amos Jeffries [Wed, 21 Aug 2013 07:48:00 +0000 (01:48 -0600)] 
Show number of available filedescriptors when reserved FD changes

12 years agoFixed src/tests/testRock build.
Alex Rousskov [Fri, 16 Aug 2013 14:44:40 +0000 (08:44 -0600)] 
Fixed src/tests/testRock build.

12 years agoFixed swap_file_sz calculation when loading rock entries. Polished debugging.
Alex Rousskov [Thu, 15 Aug 2013 22:26:40 +0000 (16:26 -0600)] 
Fixed swap_file_sz calculation when loading rock entries. Polished debugging.

Supply storeRebuildParseEntry() with known "swap file size" so that it can
adjust swap_file_sz after loading store entry meta info.  Entries are often
stored with swap_file_sz in the meta header missing the swap_hdr_len
component. storeRebuildParseEntry() adds swap_hdr_len when needed, using known
entry size to detect that need.

12 years agoDo not use StoreEntry::swap_file_sz to write DbCellHeader::entrySize,
Alex Rousskov [Thu, 15 Aug 2013 22:21:16 +0000 (16:21 -0600)] 
Do not use StoreEntry::swap_file_sz to write DbCellHeader::entrySize,
even during the last write.

StoreEntry::swap_file_sz is often set by storeSwapOutFileClosed, which is
called after the last write.

Also, I am not sure whether partial StoreEntry::swap_file_sz info might later
confuse store rebuild code into thinking that the whole entry is malformed.
That would be [different] bug.

12 years agoFixed DbCellHeader sanity check: Payload may occupy all space after the header.
Alex Rousskov [Thu, 15 Aug 2013 22:15:21 +0000 (16:15 -0600)] 
Fixed DbCellHeader sanity check: Payload may occupy all space after the header.