HTTPS: Difference between revisions

From Rosetta Code
Content added Content deleted
(F#)
(+ AutoHotkey)
Line 4: Line 4:


Readers may wish to contrast with the [[HTTP Request]] task, and also the task on [[HTTPS request with authentication]].
Readers may wish to contrast with the [[HTTP Request]] task, and also the task on [[HTTPS request with authentication]].
=={{header|AutoHotkey}}==
{{libheader|wininet}}
<lang AutoHotkey>
URL := "https://sourceforge.net/"
WININET_Init()
msgbox % html := UrlGetContents(URL)
WININET_UnInit()
return
#include urlgetcontents.ahk
#include wininet.ahk
</lang>


=={{header|F_Sharp|F#}}==
=={{header|F_Sharp|F#}}==

Revision as of 17:17, 24 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.

Readers may wish to contrast with the HTTP Request task, and also the task on HTTPS request with authentication.

AutoHotkey

Library: wininet

<lang AutoHotkey> URL  := "https://sourceforge.net/" WININET_Init() msgbox % html := UrlGetContents(URL) WININET_UnInit() return

  1. include urlgetcontents.ahk
  2. include wininet.ahk

</lang>

F#

The underlying .NET classes handle secure web connections the same way they manage insecure connections.

#light
let wget (url : string) =
    let c = new System.Net.WebClient()
    c.DownloadString(url)

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://sourceforge.net/]

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

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