From 37dbcad27f03fe9edd8c43875305c3d2c29b59f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Tue, 5 Sep 2017 11:24:57 +0200 Subject: [PATCH] =?UTF-8?q?Renamed=20=E2=80=9Chttp=E2=80=9D=20block=20to?= =?UTF-8?q?=20=E2=80=9Curl=E2=80=9D,=20use=20location.protocol=20(support?= =?UTF-8?q?=20https)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- history.txt | 2 ++ objects.js | 2 +- threads.js | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/history.txt b/history.txt index 3a6f7151..32a4a550 100755 --- a/history.txt +++ b/history.txt @@ -3608,6 +3608,7 @@ Fixes: 170905 ------ * German translation update +* Threads, Objects: Renamed “http” block to “url”, use location.protocol (support https) v4.1 Features: @@ -3633,6 +3634,7 @@ v4.1 Features: * two-item lists as x-y coordinate arguments for "point towards”, "go to" and “distance to” primitives * Piano keyboard as drop-down menu for entering musical notes, Thanks, Michael! * Basic “instruments” support: sine, square, sawtooth and triangle waves +* Support https in “url” reporter Fixes: * changed keyboard shortcut indicator for “find blocks” to “^” diff --git a/objects.js b/objects.js index 1658f258..3234a9ee 100644 --- a/objects.js +++ b/objects.js @@ -899,7 +899,7 @@ SpriteMorph.prototype.initBlocks = function () { reportURL: { type: 'reporter', category: 'sensing', - spec: 'http:// %s', + spec: 'url %s', defaults: ['snap.berkeley.edu'] }, reportIsFastTracking: { diff --git a/threads.js b/threads.js index 14a32229..1929a4fd 100644 --- a/threads.js +++ b/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, TableFrameMorph, ColorSlotMorph, isSnapObject*/ -modules.threads = '2017-September-01'; +modules.threads = '2017-September-05'; var ThreadManager; var Process; @@ -2265,10 +2265,19 @@ Process.prototype.reportLastAnswer = function () { // Process URI retrieval (interpolated) Process.prototype.reportURL = function (url) { - var response; + var idx, protocol, hostname, response; if (!this.httpRequest) { + // use the location protocol unless the user specifies otherwise + idx = url.indexOf('://'); + if (idx < 0) { + protocol = location.protocol + '//'; + hostname = url; + } else { + protocol = url.slice(0, idx) + '://'; + hostname = url.slice(idx + 3, url.length); + } this.httpRequest = new XMLHttpRequest(); - this.httpRequest.open("GET", 'http://' + url, true); + this.httpRequest.open("GET", protocol + hostname, true); this.httpRequest.send(null); } else if (this.httpRequest.readyState === 4) { response = this.httpRequest.responseText;