File: http2.liq

package info (click to toggle)
liquidsoap 2.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 11,912 kB
  • sloc: ml: 67,867; javascript: 24,842; ansic: 273; xml: 114; sh: 96; lisp: 96; makefile: 26
file content (105 lines) | stat: -rw-r--r-- 2,417 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
def f() =
  content_disposition =
    null.get(
      http.headers.content_disposition([('Content-Disposition', 'inline')])
    )

  test.equal(content_disposition.type, "inline")
  test.equal(content_disposition?.filename, null())
  test.equal(content_disposition.args, [])
  content_disposition =
    null.get(
      http.headers.content_disposition(
        [
          (
            'Content-Disposition',
            'attachment; filename="filename.jpg"'
          )
        ]
      )
    )

  test.equal(content_disposition.type, "attachment")
  test.equal(content_disposition?.filename, "filename.jpg")
  test.equal(content_disposition.args, [])
  content_disposition =
    null.get(
      http.headers.content_disposition(
        [
          (
            'Content-Disposition',
            "attachment; filename*=UTF-8''Na%C3%AFve%20file.txt"
          )
        ]
      )
    )

  test.equal(content_disposition.type, "attachment")
  test.equal(
    content_disposition?.filename,
    "Naïve file.txt"
  )
  test.equal(content_disposition.args, [])
  content_disposition =
    null.get(
      http.headers.content_disposition(
        [
          (
            'Content-Disposition',
            "attachment; filename=Na%C3%AFve%20file.txt"
          )
        ]
      )
    )

  test.equal(content_disposition.type, "attachment")
  test.equal(
    content_disposition?.filename,
    "Naïve file.txt"
  )
  test.equal(content_disposition.args, [])
  content_disposition =
    null.get(
      http.headers.content_disposition(
        [
          (
            'Content-Disposition',
            "attachment; filename=Naïve file.txt"
          )
        ]
      )
    )

  test.equal(content_disposition.type, "attachment")
  test.equal(
    content_disposition?.filename,
    "Naïve file.txt"
  )
  test.equal(content_disposition.args, [])
  content_disposition =
    null.get(
      http.headers.content_disposition(
        [
          (
            'coNtent-dispOsition',
            "attachment; filename*=UTF-8''Na%C3%AFve%20file.txt; \
             name=\"gni%20gno\"; foo=bla"
          )
        ]
      )
    )

  test.equal(content_disposition.type, "attachment")
  test.equal(
    content_disposition?.filename,
    "Naïve file.txt"
  )
  test.equal(
    content_disposition?.name,
    "gni gno"
  )
  test.equal(content_disposition.args, [("foo", "bla")])
  test.pass()
end

test.check(f)