Amos Jeffries [Tue, 31 Dec 2013 14:33:43 +0000 (06:33 -0800)]
Convert Http1Parser header block to SBuf storage
This does add a data copy for the mime headers block, but allows us to
consume data out of the underlying I/O buffer and parse the block into
SBuf cheaply.
Remove the now useless hdr_start, hdr_end, mimeHeaderBytes_ members.
Amos Jeffries [Mon, 30 Dec 2013 21:22:56 +0000 (13:22 -0800)]
Make Http1Parser::parseRequestFirstLine() private and document
Also shuffle the prefix garbage tolerance processing to a separate method
skipGarbageLines() and document the intended operations (it is currently
non-conformant with RFC 2616).
Amos Jeffries [Mon, 30 Dec 2013 18:18:03 +0000 (10:18 -0800)]
Shuffle request headersEnd call into Http1Parser::parseRequest actions
Http1Parser will now respond with signals for 'incomplete parse' until
the entire first line and any mime headers are present. The size and
content of mime headers are guaranteed once the parser responds with a
true result.
HTTP/0.9, HTTP/1.* and future versions using "HTTP/" are all accounted for
and handled in accordance with HTTP RFC 2616 requirements (adjusted for
later HTTPbis WG clarifications).
Amos Jeffries [Sat, 28 Dec 2013 01:03:29 +0000 (17:03 -0800)]
Make HttpParser parse method directly into HttpRequestMethod object
There appears to be no need for the HTTP method object to be outside
the parser. We can simplify the processing code by parsing directly into
the object from the I/O buffer.
TODO:
* fix parsing of whitespace prefix in accordance with HTTPbis specs.
* make parser incremental to end of method
Alex Rousskov [Fri, 27 Dec 2013 18:37:26 +0000 (11:37 -0700)]
Updated tests/testRock and the store rebuild stubs it needs.
Synced tests/testUfs after updating the store rebuild stubs.
Store uses StoreController::store_dirs_rebuilding to decide whether the entry
release should be delayed. Thus, storeRebuildComplete() must update it. Also
synced the corresponding CPPUNIT_ASSERT_EQUAL() statements to expect a zero
value after the rebuild is completed.
Do not create an entry just to get its key: Creating forces a public key which
necessarily invalidates the previously cached entry with the same key, if any.
Unlock unused entries. This helps with their release later (and adds more
realism to the test case).
Fixed entry #5 test case to account for the fact that creating a second entry
with the same public key invalidates the first entry.
Release instead of just unlinking entries. StoreEntry::release() is the public
interface which updates internal tables as needed. StoreEntry::unlink() is an
internal call for updating the disk cache-related state; it does not update
the the in-transit index.
Add support for FTP MLSD and MLST commands (RFC 3659)
FileZilla is a popular FTP clients supporting that command (via FEAT detection).
It will use MLSD instead of LIST if the server claims support for MLST and/or
MLSD command.
Amos Jeffries [Mon, 23 Dec 2013 11:21:48 +0000 (03:21 -0800)]
Make HttpParser parse version directly into AnyP::ProtocolVersion object
There appears to be no need for the protocol version object to be outside
the parser. We can simplify the processing code by parsing directly into
the object from the I/O buffer.
Alex Rousskov [Mon, 23 Dec 2013 05:26:23 +0000 (22:26 -0700)]
Bug 3806: Caching responses with Vary header
Various fixes making Vary caching work better.
More work is needed to re-enable shared memory caching of Vary responses.
bag5s r12741: Do not start storing the vary marker object until its key becomes public.
bag5s r12742: Log failed (due to "Vary object loop" or "URL mismatch") hits as TCP_MISSes.
bag5s r12743: Refuse to cache Vary-controlled objects in shared memory (for now).
Jakob Bohm [Sat, 21 Dec 2013 17:31:59 +0000 (09:31 -0800)]
Bug 3985: 60s limit introduced by balance_on_multiple_ip breaks bad IP recovery
Alternative fix if necessary would be to calculate a dynamic timeout
value based on number and timeouts for connections and forwarding.
However, as noted in the bug report the address markings are reset every
TTL when the stored RR are replaced. This meets the criteria for periodic
retries of marked-BAD IPs. Also if all IPs are marked BAD they all get
un-marked and retried. So for now just remove the TTL hack.
Amos Jeffries [Sat, 21 Dec 2013 04:54:54 +0000 (20:54 -0800)]
Fix \-unescaping in quoted strings from helpers
strwordtok() was unescaping '\' values in unquoted tokens. This causes
problems with NTLM helper response user\DOMAIN values which are sent as
a un-quoted un-escaped value.
Restrict un-escaping of '\' to only occur when inside "quoted" words.
Amos Jeffries [Fri, 20 Dec 2013 11:34:44 +0000 (03:34 -0800)]
WCCPv2: fix assertion 'Cannot convert non-IPv4 to IPv4' on FreeBSD
FreeBSD does not set the from-address on recv() if there was an error
reading the packet. This can result in Ip::Address assertion if the
error is not checked for before the IP address is mapped into Squid
internal format.
Alex Rousskov [Wed, 18 Dec 2013 17:19:00 +0000 (10:19 -0700)]
Added send_hit and store_miss squid.conf directives
to control caching of responses using response info.
The existing "cache" directive is checked before Squid has access to the
response and, hence, could not use response-based ACLs such as http_status.
Response-based ACLs may be essential when fine-tuning caching. Squid Bug 3937
(StoreID can lead to 302 infinite loop) is a good use case.
Updated old "cache" directive documentation to provide more information, to
help folks distinguish the three related directives, and to polish for
clarity.
TODO: Support lookup_hit and possibly deprecate/remove "cache".
Moved CharacterSet's backing storage to std::vector<uint8_t> to gain speed at the expense of space.
Improved CharacterSet's constructor
Made CharacterSet's name parameter optional with default value.
Urls contain ipv6 ipaddresses may not logged correctly
The urls which include an ipv6 address as hostname does not logged correctly
in the following cases:
- When a user is already logged in to an ftp server and a
new USER command entered with ipv6 address as hostname the logged url
does not put ipv6 address inside brackets ([]).
- On FTP error responses generated by squid the url which includes ipv6
addresses apearred with brackets urlencoded. eg:
ftp://%5B::1%5D/
Amos Jeffries [Thu, 12 Dec 2013 09:41:39 +0000 (01:41 -0800)]
Fix linker errors "relocation R_X86_64_32 against .rodata"
... "can not be used when making a shared object; recompile with -fPIC"
Caused by some libraries built without libtool in certain environments.
NP: there are other libraries in Squid built without libtool but they
appear not to be having these linker issues at this time.
Also, fixes "undefined symbol eui64_aton" uncovered by these changes.
This feature works as follows:
- Squid probes the remote directory by inserting PWD commands after the initial
login and after every CWD command sent by the client.
- Squid remembers the current directory
- client-side generates the URL in pseudo HTTP requests from the domain name
and the current directory (e.g. GET ftp://ftp.example.com/pub).
- For FTP commands with directories or file names as arguments (e.g. file
donwload/upload, directory listing), these arguments are appended to the
current directory (e.g. “RETR project/file.txt” becomes
“GET ftp://ftp.example.com/pub/project/file.txt”;).
The feature can be controlled via a new ftp-track-dirs=[on|off] option for the
ftp_port squid.conf parameter.
Ftp server directory tracking is disabled by default.
Amos Jeffries [Wed, 11 Dec 2013 11:12:43 +0000 (03:12 -0800)]
Regression in URL helper API
The backward compatibility logics in redirect.cc are not working as
intended on redirection URLs due to the presence of '=' in the URL and
how the key=value name parsing is performed.
A typical redirection URL looks like:
http://example.com/?url=http://www.example.net/
and 3.4 has a parser that splits tokens at '=' unconditionally and then
passes the bits as a key and value to the redirector logics which
complains that it does not understand the answer of the URL redirector.
Or treats is an an unknown key=value with no redirection URL.
Either case is handled as a no-redirection result from the helper.
This limits the key names to alphanumeric, hyphen and underscore
characters. Valid URL responses contain characters outside this set and
should no longer be interpreted as keys regardless of the '=' character.
Amos Jeffries [Wed, 11 Dec 2013 01:30:34 +0000 (17:30 -0800)]
Fix infinite-loop in CharacterSet::operator+=()
The uint8_t type value cannot represent the value 256, which is why we
use it as the loop terminator and an iterator of a size larger than
8-bit with a down-cast to prevent the vector accidentally being grown by
an overflow.