Re: [squid-users] using request_body_max_size inside an acl (second time post)

From: Chris Robertson <crobertson@dont-contact.us>
Date: Tue, 20 Jun 2006 11:00:11 -0800

ankush grover wrote:

>>
>> Should work, but you may want to tune the script to also handle "no
>> content-length"... (should dump warnings in your cache.log in the
>> current design)..
>
>
> hey Mr. Henrik,
>
> Thanks for the reply. Can you tell me how to handle "no
> content-length" the script I am using is below for content-length is
> below
>
> the request_body_max_size script for content-length
>
> #!/bin/sh
> while read line; do
> set -- $line
> length="$1"
> limit="$2"
> if [ "$length" -le "$2" ]; then

Change the above line to...

if [ -n "$length" ] && [ "$length" -le "$2" ]; then

... as this will check to make sure $length is defined. Given the
context of its usage, this should be sufficient error checking. If you
wish to allow requests without a content-length, use...

if [ -z "$length" ] || [ "$length" -le "$2" ]; then

...instead.

> echo OK
> else
> echo ERR
> fi
> done
>
> The warning in cache.log is below
>
> /etc/squid/request.sh: line 6: [: -: integer expression expected
>
> Thanks & Regards
>
> Ankush Grover

Chris
Received on Tue Jun 20 2006 - 13:00:20 MDT

This archive was generated by hypermail pre-2.1.9 : Sat Jul 01 2006 - 12:00:02 MDT