Skip to main content
KlausFriese
Inspiring
October 30, 2017
Question

Problems with getURL by Kris Coppieters ..

  • October 30, 2017
  • 2 replies
  • 1139 views

Hi,

I need to make a HTTPS connection from my extension and discovered the getURL by Kris Coppieters here in the forum ( http://coppieters.nz/?p=133  ) . Now I like to understand how it's working and learn how I can use HTTPS in my extension. I think I already understand some things, but at the moment I can't get it running here.

I downloaded all the files and when I try to install the example extension with the extension manager I get the german error message "Erforderliche Daten aus der Datenbank konnten nicht gefunden werden. Die Erweiterung wird nicht installiert" which means "Can not find required data from the database. The extension is not installed". I don't find anything helpfull about this errormessage in german, I don't know the exact errormessage in english so I can't search for it. When I try to install again, the extension manager says that the extension is already installed - but I can't see it in the list. And it also doesn't work.

After a day of searching I'm a bit lost here. Does anyone has an idea how where the problem is?

Thanks

Klaus

This topic has been closed for replies.

2 replies

Trevor:
Legend
November 2, 2017

Hi Klaus

Make sure you have a post 11-Oct-2017 version as the one previous version had a bug of Kris's script.

If you want to stay inside the world of ExtendScript then Marc's version has a big plus.

If you need speed I would presume the Kris's is quite a bit faster as it uses native modules but I never did a speed comparison test so you could test for yourself or get feedback from than on Marc.

Marc Autret
Legend
November 2, 2017

Hi Klaus,

Kris will surely answer you soon.

Meanwhile, note that IdExtenso also provides an experimental https support in its Web module. If you want to give it a try, just download the framework from GitHub (ZIP: https://github.com/indiscripts/IdExtenso/archive/master.zip) and use the $$.Web.get(…) method to retrieve http or https contents.

Here is a simple example:

// path/to/idextenso

#include '../$$.jsxinc'

// Web module.

#include '../etc/$$.Web.jsxlib'

// Load the framework.

$$.load();

function myHttpsTest()

{

    const url = "https://raw.githubusercontent.com/indiscripts/IdExtenso/master/README.md";

    var result = $$.Web.get(url, 1/*text expected*/);

    if( !result.error )

    {

        var msg = result.data.replace(/[\*#]+/g,'');

        alert( msg.substr(0,1500) + " (. . .)" );

    }

    else

    {

        alert( result.error );

    }

};

// Go to the test.

try{ myHttpsTest() } catch(e){ $$.receiveError(e) }

// Unloading the framework is cleaner.

$$.unload();

In case this wouldn't work, bug reports highly appreciated :-)

@+

Marc

KlausFriese
Inspiring
November 6, 2017

Hi Marc,

I just installed IdExtenso - is there a way to submit a Basic Authorization with the GET?

Klaus

Marc Autret
Legend
November 6, 2017

Hi Klaus,

is there a way to submit a Basic Authorization with the GET?

That's a difficult question to me, but I'm afraid you cannot.

Technically, Basic Access Authentication through http (or https) shouldn't be URL-encoded. The scheme http(s)://user:pwd@www.server.com is highly deprecated today, so the GET command alone is not enough to authenticate the user.

Furthermore, since IdExtenso deals with https using alternate shell commands—curl on Mac OS and CreateObject("MSXML2.XMLHTTP") on Win platforms—my solution is not designed to support additional authentication patterns (so far.) In short, the purpose of $$.Web.get(...) is just to send a GET command through the protocol and nothing more.

However, I'm hopeful that a programmer better than me in http(s) issues could enhance both my AppleScript (curl stuff) and my VBScript (XMLHTTP stuff) so that they support authentication. As a starting point, $$.Web.parseURI(uri) returns all desired information (authority, userInfo, user, and password properties) that may be required to extract authentication data, assumed you pass them in the uri param. From then, advanced curl command(s) might do the job— cf. credentials - Using cURL with a username and password? - Stack Overflow. And we likely have similar tricks in VBScript.

I'd be very interested to hear insights on this topic.

@+

Marc