Annotation of parser3/tests/450-curl.html, revision 1.3
1.1 moko 1: @main[]
2:
3: 1. curl resolve exception:
4: ^try-catch{ ^curl:load[ $.url[https://no-such-domain] ] }
5:
6: #resolve option tests: with the nproc limit set below, the curl threaded resolver
7: #fails to start a getaddrinfo thread, so every request must be resolved
8: #either via explicit resolve entries or via the 'parser' resolve mode
9:
10: $ip[^inet:name2ip[www.parser.ru]]
1.3 ! moko 11:
! 12: ^try-catch{ $status:limit-nproc(1) }
1.1 moko 13:
14: 1.2. parser resolve exception:
15: ^try-catch{ ^curl:load[ $.url[https://no-such-domain] $.resolve[parser] ] }
16:
17: 1.3. detailed resolver error message from CURLOPT_ERRORBUFFER:
18: ^try-catch{ ^curl:load[ $.url[https://no-such-domain] ] }
19:
20: 2. explicit resolve entries populate DNS cache bypassing the resolver:
21: ^load[ $.resolve[ $.[www.parser.ru:80][$ip] ] ]
22:
23: 2.1. port-less entry covers both http and https:
24: ^load[ $.resolve[ $.[www.parser.ru][$ip] ] ]
25: ^load[ $.resolve[ $.[www.parser.ru][$ip] ] ;https://www.parser.ru/_/tests/readme]
26:
27: 3. 'parser' mode resolves synchronously and populates the resolve list automatically:
28: ^load[ $.resolve[parser] ]
29:
30: 4. 'parser' mode can be set outside of 'session' operator:
31: ^curl:options[ $.resolve[parser] ]
32: ^load[]
33:
34: 5. explicit entries have priority over 'parser' mode:
35: ^curl:session{
1.2 moko 36: ^curl:options[ $.resolve[ $.[www.parser.ru][195.218.200.197] ] ]
37: connects to rol8: ^try-catch-filtered{ ^load[] }
38: ^curl:options[ $.resolve[^hash::create[]] ]
39: parser resolves to real IP: ^load[]
1.1 moko 40: }
41:
42: 6. revert to 'curl' mode:
43: ^curl:options[ $.resolve[curl] ]
44: ^try-catch{ ^load[] }
45:
46: 7. second load finds the entry added by the first one:
47: ^curl:session{
48: ^curl:options[ $.resolve[parser] ]
49: ^load[]
50: ^curl:options[ $.resolve[curl] ]
51: 7.1. http OK: ^load[]
52: 7.2. https fails (OK): ^try-catch{ ^load[;https://www.parser.ru/_/tests/readme] }
53: }
54:
55: 8. port option is used instead of :port in url:
56: 8.1. ^try-catch-filtered{ ^load[ $.resolve[parser] $.port(8080) ] }
57: ^curl:options[ $.resolve[parser] ]
58: 8.2. ^load[;http://www.parser.ru:80/_/tests/readme]
59: 8.3. ^try-catch-filtered{ ^load[ $.port(8080) ;http://www.parser.ru:80/_/tests/readme] }
60:
61: 9. ^try-catch{ ^curl:options[ $.resolve[dns] ] }
62:
63: 10. empty mode = 'curl' mode:
64: ^curl:options[ $.resolve[] ]
65: ^try-catch{ ^load[] }
66:
67: @load[options;url]
68: ^show[^curl:load[ $options $.url[^if(def $url){$url}{http://www.parser.ru/_/tests/readme}] $.timeout(4) ]]
69:
70: @show[f]
71: status: $f.status, size: $f.size
E-mail: