Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 47 lines (34 sloc) 1.134 kb
bba8964 Alvaro Lopez Ortega The Cache-Control header was being duplicated whenever a configuration
alobbs authored
1 # -*- coding: utf-8 -*-
2
3 import os
4 from base import *
5
6 DIR = "dup-cache-control-1"
7 FILE = "file"
8 EXT = "test246"
9 MAGIC = "Alvaro: http://www.alobbs.com/"
10
11 CONF = """
12 vserver!1!rule!2460!match = directory
13 vserver!1!rule!2460!match!directory = /%s
14 vserver!1!rule!2460!match!final = 0
15 vserver!1!rule!2460!expiration = time
16 vserver!1!rule!2460!expiration!time = 2m
17
18 mime!application/xml!extensions = %s
19 mime!application/xml!max-age = 0
20 """ % (DIR, EXT)
21
22
23 class Test (TestBase):
24 def __init__ (self):
25 TestBase.__init__ (self, __file__)
26 self.name = "Dup Cache-Control: max-age"
27
28 self.request = "GET /%s/%s.%s HTTP/1.0\r\n" %(DIR, FILE, EXT)
29 self.expected_error = 200
30 self.expected_content = MAGIC
31 self.conf = CONF
32
33 def Prepare (self, www):
34 d = self.Mkdir (www, DIR)
35 self.WriteFile (d, "%s.%s"%(FILE,EXT), 0666, MAGIC)
36
37 def CustomTest (self):
38 body_low = self.reply.lower()
39
40 if body_low.count("cache-control") != 1:
41 return -1
42
43 if body_low.count("max-age=") != 1:
44 return -1
45
46 return 0
Something went wrong with that request. Please try again.