[PATCH] Test proxy_unfinished: limit sndbuf to force buffering on no proxy temp

Markus Linnala Markus.Linnala at cybercom.com
Tue Apr 15 14:55:51 UTC 2014


# HG changeset patch
# User Markus Linnala <Markus.Linnala at cybercom.com>
# Date 1397505734 -10800
#      Mon Apr 14 23:02:14 2014 +0300
# Node ID a548e5a5cf251ee97fb782d6b9e6c374389782ea
# Parent  74a015aad3521ffef6b404cdaa9eafd991824301
Test proxy_unfinished: limit sndbuf to force buffering on no proxy temp

With some systems (Fedora-20 Linux 3.13) socket buffers are huge and
nginx does not use temp files when proxying. Set sndbuf to small
values to make use of temp files around 90k sent. Currently there is
no way to force temp buffers. If sndbuf is more than 36k test seems to
fail.

no proxy temp should fail on 1.5.2 and work okay on later versions.

sub_filter forces chunked encoding and so it is possible to notice
problem because last chunk is 0 chunk when there is error.

http://trac.nginx.org/nginx/ticket/541

I did not notice any changes with sleep or limited proxy buffers.
So I dropped them.

Changed patch as per suggestion from Maxim Dounin.

diff -r 74a015aad352 -r a548e5a5cf25 proxy_unfinished.t
--- a/proxy_unfinished.t	Mon Mar 17 16:02:19 2014 +0400
+++ b/proxy_unfinished.t	Mon Apr 14 23:02:14 2014 +0300
@@ -50,7 +50,7 @@
                        keys_zone=one:1m;
 
     server {
-        listen       127.0.0.1:8080;
+        listen       127.0.0.1:8080 sndbuf=4k;
         server_name  localhost;
 
         location / {
@@ -76,8 +76,6 @@
             sub_filter foo bar;
             sub_filter_types *;
             proxy_pass http://127.0.0.1:8080/local/;
-            proxy_buffer_size 1k;
-            proxy_buffers 4 1k;
         }
 
         location /local/ {
@@ -159,7 +157,7 @@
 # no final chunk
 
 chmod(0000, $t->testdir() . '/proxy_temp');
-like(http_get_11('/proxy/big.html', sleep => 0.5),
+like(http_get_11('/proxy/big.html'),
 	qr/X(?!.*\x0d\x0a?0\x0d\x0a?)/s, 'no proxy temp');
 
 }



More information about the nginx-devel mailing list