[PATCH] HelperReply upgrade stage 3

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 25 Nov 2012 04:27:23 +1300

[this patch applies on top of the stage 2 patch submitted earlier]

This stage of the helper reply protocol adds kv-pair support to the
url_rewrite_helper interfacefor URL redirect and rewriteoperations.

It uses the new Notes objects and kv-pair field added by the stage 2
helper protocol instead of parsing the 'other' field.

The response syntax for URL helpers becomes:
   [channel-ID SP ] result [ SP kv-pair ... ] [ SP other] EOL

* 'other' field is now deprecated and will be ignored/discarded on any
response containing a result code field.

When result code "OK" is presented by the helper several kv-pairs are
reserved to control Squid actions:

* "rewrite-url=" is added to return a re-written URL.
  - When this key is presented the URL is re-written to the new one by
Squid without client interaction.
  - The 'url' keys presence will override this key.

* "url=" is added to return the redirected-to URL.
  - When this key name is presented an HTTP redirect response is
generated for the client.
  - This keys presence overrides the 'rewrite-url' key actions.

* "status=" is added to hold the HTTP status code for use in redirect
operations.
  - This field is optional and status is no longer required for marking
redirect actions.
  - If no redirect status is provided Squid will assign one (currently
the default is 302, that may change in the future).
  - This key is only relevant when 'url' key is also presented. In all
other uses it is currently ignored.

When result codes BH or ERR are presented by the helper no redirect or
rewrite action is performed and no kv-pair key names are reserved for
use at this time.

The URL rewrite/redirect handler is updated to map old protocol
responses into these kv-pairs. This mapping is only performed on
requests in the old format *without* a results code.

Any other keys MAY be sent on any response. The URL helper interface
makes no other use of them, but this patch does pass them on to the ALE
object for logging as transaction Notes. All kv-pairs returned by the
helper (including the url, stauts rewrite-url keys) are available for
logging via the %{...}note log format option.

As with changes to other helpers interfaces in stage2 patch earlier,
only the first value presented for any of the reserved kv-pairs is used.
Multiple values are accepted as notes, but otherwise ignored by Squid
and do not affect the transaction outcome.

Additionally, when the BH result code is received from the helper a
simple recovery is attempted. The lookup request will be re-scheduled
(up to once) in an attempt to find a better responding helper.

  This update was sponsored by Edgewave.

Amos

Received on Sat Nov 24 2012 - 15:27:38 MST

This archive was generated by hypermail 2.2.0 : Tue Nov 27 2012 - 12:00:08 MST