RejectedSoftware Forums

Sign up

requestHTTP https

Having trouble dealing with HTTPS in a requestHTTP method.

import vibe.core.log;
import vibe.http.client;


shared static this()
{
    requestHTTP("http://www.google.com/",
        (scope req) {logInfo("Request");
        },
        (scope res) {
            logInfo("Response: %d", res.statusCode);
        }
    );
}

vs

import vibe.core.log;
import vibe.http.client;


shared static this()
{
    requestHTTP("https://www.github.com/",
        (scope req) {logInfo("Request");
        },
        (scope res) {
            logInfo("Response: %d", res.statusCode);
        }
    );
}

here is the error for the https version

Error executing command run:
Program exited with code -11
Full exception: object.Exception@source/dub/generators/build.d(481): Program exited with code -11
----------------
5   dub                                 0x000000010bca55fa pure @safe bool std.exception.enforce!(bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) + 94
6   dub                                 0x000000010bbb3218 void dub.generators.build.BuildGenerator.runTarget(dub.internal.vibecompat.inet.path.Path, const(dub.compilers.buildsettings.BuildSettings), immutable(char)[][], dub.generators.generator.GeneratorSettings) + 1324
7   dub                                 0x000000010bbaf59d void dub.generators.build.BuildGenerator.performPostGenerateActions(dub.generators.generator.GeneratorSettings, const(dub.generators.generator.ProjectGenerator.TargetInfo[immutable(char)[]])) + 401
8   dub                                 0x000000010bbb7114 void dub.generators.generator.ProjectGenerator.generate(dub.generators.generator.GeneratorSettings) + 928
9   dub                                 0x000000010bb78e3a void dub.dub.Dub.generateProject(immutable(char)[], dub.generators.generator.GeneratorSettings) + 150
10  dub                                 0x000000010bb673e0 int dub.commandline.GenerateCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 1636
11  dub                                 0x000000010bb6778e int dub.commandline.BuildCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 130
12  dub                                 0x000000010bb6799e int dub.commandline.RunCommand.execute(dub.dub.Dub, immutable(char)[][], immutable(char)[][]) + 130
13  dub                                 0x000000010bb64def int dub.commandline.runDubCommandLine(immutable(char)[][]) + 4811
14  dub                                 0x000000010bb60fe4 _Dmain + 32
15  dub                                 0x000000010bc7d760 D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
16  dub                                 0x000000010bc7d6a5 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
17  dub                                 0x000000010bc7d705 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 45
18  dub                                 0x000000010bc7d6a5 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 45
19  dub                                 0x000000010bc7d621 _d_run_main + 433
20  dub                                 0x000000010bb61000 main + 20
21  libdyld.dylib                       0x00007fff992b15ad start + 1
22  ???                                 0x0000000000000003 0x0 + 3

Is there something needed to call https in this method?

Re: requestHTTP https

I can't reproduce the crash (the exit code indicates that a segmentation fault happened in the app). Can you try to run this in GDB (or LLDB) and post a stack trace? Which event driver do you use, the default libevent one, or libasync?