File: 136-BadRange.py

package info (click to toggle)
cherokee 0.7.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,808 kB
  • ctags: 6,577
  • sloc: ansic: 45,071; python: 9,628; sh: 9,468; makefile: 1,639; xml: 61; perl: 32
file content (21 lines) | stat: -rw-r--r-- 588 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import random
import string
from base import *
from util import *

LENGTH = 100

class Test (TestBase):
    def __init__ (self):
        TestBase.__init__ (self)
        self.name = "Bad Content Range"

        self.request           = "GET /BadRange1 HTTP/1.0\r\n" +\
                                 "Range: bytes=%d-%d\r\n" % (LENGTH+2 ,LENGTH+3)
        self.expected_error    = 416
        self.expected_content  = "Content-Range: bytes */%d" % (LENGTH)

    def Prepare (self, www):
        random  = letters_random (LENGTH)
        self.WriteFile (www, "BadRange1", 0444, random)