HTTPS: Difference between revisions

From Rosetta Code
Content added Content deleted
m (HTTPS request moved to HTTPS Request: get capitalization right)
(→‎Tcl: Added implementation)
Line 2: Line 2:


Print an HTTPS URL's content to the console. Checking the host certificate for validity is recommended. The client should not authenticate itself to the server — the webpage https://sourceforge.net/ supports that access policy — as that is the subject of other tasks.
Print an HTTPS URL's content to the console. Checking the host certificate for validity is recommended. The client should not authenticate itself to the server — the webpage https://sourceforge.net/ supports that access policy — as that is the subject of other tasks.

=={{header|Tcl}}==
Uses the Tls package.
<lang tcl>package require http
package require tls
http::register https 443 ::tls::socket
# Make a secure connection
set token [http::geturl https://secure.example.com/]
# Now as for conventional use of the “http” package
set data [http::data $token]
http::cleanup $token</lang>

Revision as of 10:14, 1 June 2009

Task
HTTPS
You are encouraged to solve this task according to the task description, using any language you may know.

Print an HTTPS URL's content to the console. Checking the host certificate for validity is recommended. The client should not authenticate itself to the server — the webpage https://sourceforge.net/ supports that access policy — as that is the subject of other tasks.

Tcl

Uses the Tls package. <lang tcl>package require http package require tls http::register https 443 ::tls::socket

  1. Make a secure connection

set token [http::geturl https://secure.example.com/]

  1. Now as for conventional use of the “http” package

set data [http::data $token] http::cleanup $token</lang>