Re: [squid-users] request_body_max_size ?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Mon, 26 Apr 2004 19:35:47 +0200 (CEST)

On Mon, 26 Apr 2004, Michael Gale wrote:

> Can I use "request_body_max_size" inside a acl ?

There only is one single limit in this directive.

But it is possible to invent a new acl for this using the external acl
interface. request_body_max_size looks into the Content-Length request
header, available to external_acl_type as %{Content-Length}

This silly shell script should work

#!/bin/sh
while read line; do
  set -- $line
  length="$1"
  limit="$2"
  if [ "$length" -le "$2" ]; then
     echo OK
  else
     echo ERR
  fi
done

Use this as

external_acl_type request_body %{Content-Length} /path/to/above/script

acl request_max_20MB request_body 20971520

This acl can then be used in http_access to match requests up to the given
size. If you need different sizes just define new acls with different
limits in bytes (20971520 == 20480 * 1024 == 20480 KB)

Regards
Henrik
Received on Mon Apr 26 2004 - 11:35:50 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Apr 30 2004 - 12:00:02 MDT