singe/thirdparty/openssl/gost-engine/tcl_tests/http.tcl
2023-11-16 22:15:24 -06:00

27 lines
815 B
Tcl
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# Получает в командной строке URL и (опционально) строку для поиска
# сертификата. Выполняет HTTP-запрос и возрвщает результат
# В строке для поиска сертификата можно использовать прямые слэши вместо
# обратных.
if {!$argc || $argc>2} {
puts stderr "Usage $argv0 url \[cert-spec\]"
}
set url [lindex $argv 0]
if {$argc==2} {
set certspec [string map {/ \\} [lindex $argv 1]]
}
puts Started
package require tcom
set hh [::tcom::ref createobject WinHttp.WinHttpRequest.5.1]
$hh Open GET $url 0
if {[info exists certspec]} {
puts "Setting Client Certificate $certspec"
$hh SetClientCertificate $certspec
}
$hh Send
puts [$hh ResponseText]