aboutsummaryrefslogtreecommitdiff
path: root/tests/curl/testscript
blob: d2056cd69ea68d024cc7654a126341ebb193afb2 (plain)
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
# file      : tests/curl/testscript
# license   : MIT; see accompanying LICENSE file

#\

TFTP server (tftp-hpa) setup: from the test out_base, run (sudo is required
for --secure/chroot):

sudo /usr/sbin/in.tftpd \
  --foreground \
  --address 127.0.0.1:55123 \
  --user "$(whoami)" \
  --permissive \
  --create \
  --secure \
  "$(pwd)"

#\

: tftp
:
{
  echo 'foo' >=foo-src;

  $* 'tftp' &foo &bar 2>>EOE;

  curl -s -S tftp://localhost:55123/test-driver/tftp/foo
  curl: (68) TFTP: File Not Found

  curl -s -S --upload-file foo-src tftp://localhost:55123/test-driver/tftp/foo

  curl -s -S --upload-file - tftp://localhost:55123/test-driver/tftp/bar

  curl -s -S tftp://localhost:55123/test-driver/tftp/foo

  curl -s -S tftp://localhost:55123/test-driver/tftp/foo
  EOE

  diff -u foo-src foo;
  diff -u - bar <'bar'
}

: http
:
{
  $* 'http' 2>>~%EOE%

  curl -sS --fail --location https://build2.org/bogus
  %curl: \(22\) The requested URL returned error: 404( Not Found)?%

  curl -sS --fail --location https://build2.org

  curl -sS --fail --location --data-binary @- https://build2.org/bogus
  %curl: \(22\) The requested URL returned error: 404( Not Found)?%

  curl -sS --location --data-binary @- https://build2.org/bogus

  curl -sS --fail --location --data-raw "" --verbose https://build2.org/bogus
  %.*
  %> POST /bogus HTTP.+%
  %.*
  %curl: \(22\) The requested URL returned error: 404( Not Found)?%
  EOE
}