Alex Rousskov [Tue, 24 Aug 2010 22:05:52 +0000 (16:05 -0600)]
Possible fix for an OpenSolaris "pureparm" compilation error.
Our CallJobHere1() macro tried to help the compiler to determine the right
JobMemFun() profile by explicitly specifying the first JobMemFun() template
argument type. There is a second template argument in the CallJobHere1 case,
but we cannot specify it explicitly. Apparently, OpenSolaris compiler got
confused, perhaps justifiably so, by only one template argument specified.
This change removes the explicit first template parameter from the JobMemFun()
call inside the CallJobHere1(). It does not seem to be required for GCC on
RHEL5. Tests will show what other compilers think.
Henrik Nordstrom [Tue, 24 Aug 2010 21:04:22 +0000 (23:04 +0200)]
Strengthen the internal DNS client somewhat by making sure to keep
the receive queue drained. Also avoid parsing messages unless we
have a pending query.
Alex Rousskov [Tue, 24 Aug 2010 04:18:51 +0000 (22:18 -0600)]
Compliance: remove Content-Length header if Transfer-Encoding is present.
If after HTTP header parsing we have both "Transfer-Encoding: chunked"
and Content-Length headers, remove the Content-Length entry. The
adjusted behavior follows httpbis recommendations (ticket #95, part 2).
The old client-side code forwarded the original Content-Length header
which did not match the [dechunked] response, resulting in a malformed
response.
HttpHeader::chunked() method added to check if HTTP headers contain
chunked Transfer-Encoding header. Use this method in code that checks
for chunked encoding.
Co-Advisor test cases: test_case/rfc2616/chunked-1p0-badClen-toClt
test_case/rfc2616/chunked-1p1-badClen-toClt
Alex Rousskov [Tue, 24 Aug 2010 04:07:00 +0000 (22:07 -0600)]
Compliance: respond to OPTIONS requests with a zero Max-Forwards value.
RFC 2616 section 9.2 says that a proxy MUST NOT forward requests with a
zero Max-Forwards value. RFC 2616 does not define any proper OPTIONS
responses, so we consider successful responses optional and reply with
501 Not Implemented.
No change in handling OPTIONS requests with positive Max-Forwards values.
While TRACE and OPTIONS are similar with regard to Max-Forwards, we
handle them in different places because OPTIONS responses do not need to
echo the request via Store.
Co-Advisor test case: test_case/rfc2616/maxForwardsZero-OPTIONS-absolute
Alex Rousskov [Tue, 24 Aug 2010 00:02:15 +0000 (18:02 -0600)]
Send chunked responses if body size is unknown.
Apply HTTP chunked transfer encoding to the response body sent to client
if all of the following conditions are met:
* client claims HTTP version 1.1 or later support
* response does not have a Content-Length header already
* response does not use multipart/byteranges encoding
* connection is persistent
If we decide to send chunked reply, chunked_reply flag is set. Chunked
encoding is done in ClientSocketContext::packChunk(). The last-chunk
is sent only when clientReplyContext complete flag is set.
This change helps keep client-side connections persistent.
Alex Rousskov [Mon, 23 Aug 2010 23:15:26 +0000 (17:15 -0600)]
Bug #2583 fix: pure virtual method called
When a cbdata-protected class holds its own cbdata and has virtual
toCbdata(), there is a catch22 problem: we need cbdata to know whether
the pointer to the class object is valid, and we need to dereference
that pointer to get cbdata.
Added CbcPointer class to hold both a pointer to a potentially freed
class object and the cbdata pointer protecting that object. Keeping the
cbdata pointer allows us to test whether the object is still there
without dereferencing the object pointer.
Use the CbcPointer class to hold safe pointers to AsyncJobs. This
prevents "pure virtual method called" failures because we no longer
dereference freed job pointers.
Removed Initiator parameter from many initiatee constructors. The
Adaptation::Initiator::initiateAdaptation method now sets the initiator
of the job. This makes the constructor profile simpler and removes the
need to propagate Initiator changes through all the [nested]
constructors.
Renamed AsyncJob::AsyncStart() to AsyncJob::Start(). I had to change the
callers code anyway and it was a good opportunity to remove the
redundant "Async".
Special thanks to Stefan Fritsch for updating and testing an earlier
version of this patch.
Amos Jeffries [Wed, 18 Aug 2010 23:43:22 +0000 (17:43 -0600)]
Author: Alex Rousskov <rousskov@measurement-factory.com>
Bug 3016: HTTP/1.1 compliance: default keep-alive for 1.0/1.1 clients.
aka. NTLM Authentication with Java UA + SSL Problem
Moved httpMsgIsPersistent(version, headers) to HttpMsg::persistent(void).
This move makes it clear that the logic applies only to the message being
examined and not some irrelevant information such as HTTP version supported
by Squid.
Side-effects:
- In v3.2, Squid stops using persistent connections with HTTP/1.0 clients
that do not send "Connection: keep-alive".
- In v3.1, Squid starts using persistent connections with HTTP/1.1 clients
that do not send "Connection: close".
- HttpReply now sets HttpMsg::http_ver member. It is not clear whether
that member was ever used for HttpReplies though.
Fixed "ccb->active()" assertion related to the automatic write timeout.
We need to manually cancel writer's interest in select(2) before calling back
so that select() does not try to call the write handler when there is no
active callback anymore. Normally, select() cancels writer's interest when
calling the write handler, but in this case the call back is triggered not
from select() but from checkTimeouts().
Amos Jeffries [Fri, 13 Aug 2010 11:54:31 +0000 (23:54 +1200)]
Permit rotate logs from cachemgr
Given that reconfigure, shutdown and offline already have password-protected
remote actions available it makes sense to permit the less critical rotate
as well.
Amos Jeffries [Fri, 13 Aug 2010 09:37:46 +0000 (03:37 -0600)]
Fix 32-bit wrap in refresh_pattern min/max values.
Attached patch limits the values to 1 year (arbitrary based on rumours
about good caching times). Checking for 32-bit wrap and setting the max
1 year limit instead of cutting them to zero.
The expected outcome of this is correct cache storage time extension
according to refresh_pattern documentation when people desperately set
min/max to > a million minutes. Instead of a silent always-stale verdict.
Amos Jeffries [Fri, 13 Aug 2010 07:53:08 +0000 (01:53 -0600)]
HTTP/1.1 compliance: Stop using Proxy-Connection header
The Proxy-Connection header is not part of any HTTP standard. It was added
by Netscape to differentiate persistent connections to intermediary proxies
but that duty has been formally superceded by the Connection: header.
This compliance update makes Squid stop sending Proxy-Connection on outbound
requests. Starts consistently using Connection: header instead.
The Proxy-Connection header is also ignored on HTTP-strict builds.
For compatibility we must do a small violation and drop it as a hop-by-hop
header despite strct-mode technically being required to pass it through.
For origin server connections the non-strict builds will retain the
status-quo: interpret it, but treat it as an HTTP/0.9 thing to be
upgraded to HTTP/1.1 Connection:.
Amos Jeffries [Thu, 12 Aug 2010 09:37:14 +0000 (21:37 +1200)]
Author: Stephen Thorne <stephen@thorne.id.au>
Bug 2936: NTLM-Authenticate 407 and Proxy-Connection: Close in same response.
Squid default from the days of HTTP/1.0 was to close connections unless
keep-alive was explicitly known. This changes the default to send
keep-alive unless we have a good reason to close.
Main changes and goals:
- definition of a common naming convention for shell variables
- definition of auxiliary macros to deal with common constructs (--enable-* and --with-*)
- definition of auxiliary macros to deal with autoconf defines
- improvements in configure.in readability and portability
Amos Jeffries [Mon, 9 Aug 2010 12:00:18 +0000 (06:00 -0600)]
Author: Chad Naugle <chad.naugle@travimp.com>
Bug 2999: v1.5 of ext_edirectory_userip_acl
* Modified command-line arguments to closer resemble LDAP auth helper's.
* Added much-needed 'Persistent Connections' option, with timeout.
* Cleaned up some of the debugging statements, and to make debug messages
more meaningful.
Amos Jeffries [Mon, 9 Aug 2010 08:23:45 +0000 (20:23 +1200)]
Fix ICAP service sockets for splt-stack systems.
Makes split-stack systems default to IPv4-only connections.
Adds "ipv6=on|off" option to icap_service config to make Squid do
IPv6-only connections for particular service.
There is currently no middle ground with connection failover possible.
Amos Jeffries [Sun, 8 Aug 2010 02:12:50 +0000 (14:12 +1200)]
Make FTP able to retry after stupid FTP-protocol errors.
It only really matters if PUT/POST body data was sent to the server
Or if any reply headers/data was sent to the client.
For the relative long and error-prone state in between starting to FTP
connect and actually sending the data we can retry different FTP data
setup methods and forwarding paths forever.