Debian Codegraph @

tests/soap/soaptest.sh

raw
1 #!/bin/bash
2 test "$http_proxy" || echo NOTE: proxy not set
3
4 apt-cache search abc > samplepkgs
5 cat >body.txt <<HERE
6 <?xml version="1.0" encoding="utf-8" ?>
7 <env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
10 <env:Body>
11 <n1:get_bugs env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
12 xmlns:n1="Debbugs/SOAP/">
13 <keyvalue xmlns:n2="http://schemas.xmlsoap.org/soap/encoding/"
14 n2:arrayType="xsd:anyType[4]"
15 xsi:type="n2:Array">
16 <item xsi:type="xsd:string">severity</item>
17 <item n2:arrayType="xsd:anyType[3]"
18 xsi:type="n2:Array">
19 <item xsi:type="xsd:string">critical</item>
20 <item xsi:type="xsd:string">grave</item>
21 <item xsi:type="xsd:string">serious</item>
22 </item>
23 <item xsi:type="xsd:string">package</item>
24 <item n2:arrayType="xsd:anyType[$(wc -l < samplepkgs)]"
25 xsi:type="n2:Array">
26 HERE
27 sed -e 's,[[:space:]].*,</item>,;s,^,<item xsi:type="xsd:string">,' < samplepkgs >> body.txt
28 cat >> body.txt <<THERE
29 </item>
30 </keyvalue>
31 </n1:get_bugs>
32 </env:Body>
33 </env:Envelope>
34 THERE
35
36 set -e
37 (
38 ( cat <<HEAD
39 POST http://bugs.debian.org:80/cgi-bin/soap.cgi HTTP/1.1
40 Content-Type: text/xml; charset=utf-8
41 SOAPAction: ""
42 User-Agent: SOAP4R/1.6.1-SNAPSHOT (2.3.3, ruby 2.1.5 (2014-11-13))
43 Accept: */*
44 Date: Fri, 10 Apr 2015 17:09:29 GMT
45 Host: bugs.debian.org
46 Connection: close
47 Content-Length: $(wc -c < body.txt)
48
49 HEAD
50 ) | sed -e 's,$,\r,g'
51 cat body.txt
52 ) | socket localhost 3142 > response.txt
53
54 echo Checking redirection response
55 grep HTTP.*302 response.txt || (echo Err, not redirection; exit 1)
56 grep "Location: https://bugs.debian.org:443/cgi-bin/soap.cgi" response.txt
57 ./tryssl.sh
58 #grep 200.*OK response.txt || (echo Err, not 200 ; exit 1)
59 grep soap.Envelope response.txt
60 rm -f response.txt samplepkgs body.txt