Curl Exception

Nick Sabalausky via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 11 09:17:04 PDT 2014


On 5/10/2014 9:02 AM, Jack wrote:
> First off a rant:
>
> I use the Code::Blocks IDE and at times it has been proven to a
> double-edged source because of various issueslike this one:
>
> http://forum.dlang.org/thread/ndeyzrifseipuebvyrvx@forum.dlang.org)
>
> and am now itching to search for other IDEs to suit my needs.
>

I switched from C::B to Programmer's Notepad 2 several years ago, and 
I've been happy with it:

http://www.pnotepad.org/

It's good if you're looking for a light editor rather than a heavy-duty 
IDE. Otherwise, there's VisualD and Mono-D which I hear are good.

> Now on to the question:
> Anyway, I was using std.net.curl to implement an auto updater for my
> program.
>

Sorry, I haven't really used the curl stuff yet, so I can't be a bigger 
help, but a couple notes below:

> Function code is this: http://pastebin.com/i6WnwJF5(links removed due to
> it having private content. Original host is https://dropbox.com)
>
> And the overall function was working fine in the IDE except for an
> Access Violation that I thought would work itself out when it's (run by
> administrator).
>

Access Violation, despite its wording, isn't usually about user 
permissions. It's the Windows version of a segfault. Usually means a 
null pointer was dereferenced, or a freed pointer was used, or an 
otherwise bad pointer or buffer overflow, etc. If you're really unlucky 
those can be a result of memory corruption, but that's usually not the case.


> So I Exported it to a folder with all necessary files, including the
> "cacert.pem" file and run it.
>
> Well this little error popped out : http://pastebin.com/8MmPLg2Q
>

If you recompile with "-g" ("enable debugging symbols"), then those 
annoyingly meaningless addresses will change into a proper stack trace. 
(Or try "-gc" if "-g" doesn't work.)

Is that the same error you get if you try to give it a pem file you 
*know* doesn't exist? If so, then maybe it's not looking in the 
directory you expect. Try giving it a full absolute path to the pem 
file. If that works, then it's probably looking in the directory you're 
running from instead of the directory where it actually exists. If so, 
you can use std.file.thisExePath() and build your path relative to that 
(or just stick with an absolute path).

You can also try opening your pem file directly:

auto pemFile = File("cacert.pem");

See what happens if you do that. It won't fix the problem, but seeing 
what it does it should help give you a better idea of what's going on.

> Though in the Code:: Blocks IDE there was the object.Error Access
> Violation error
> And in the actual program(.exe) this : http://pastebin.com/8MmPLg2Q
>
> Though I'm also up for not verifying the link but I still can't figure
> out how.
>
> Anyway, can anyone give me an idea what went wrong?



More information about the Digitalmars-d-learn mailing list