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