Thread overview
Curl Exception
May 10, 2014
Jack
May 10, 2014
Jack
May 11, 2014
Nick Sabalausky
May 12, 2014
Jack
May 10, 2014
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.

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

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).

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

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?
May 10, 2014
On Saturday, 10 May 2014 at 13:02:39 UTC, 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.
>
> Now on to the question:
> Anyway, I was using std.net.curl to implement an auto updater for my program.
>
> 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).
>
> 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
>
> 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?

Little typo there:
Function code is this: http://pastebin.com/i6WnwJF5
May 11, 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?

May 12, 2014
On Sunday, 11 May 2014 at 16:17:20 UTC, Nick Sabalausky wrote:
>
> Sorry, I haven't really used the curl stuff yet, so I can't be a bigger help, but a couple notes below:
>

It's alright. I'm actually up for any information right now.


> 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.

> 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.)


Weird. I am sure I wasn't dealing with any pointers, and the Curl Documentation did say that it was safe.

Though I also tried Updating my compiler and libraries and compiling with the "-g" flag lead me to a errno(STD Exception) giving me with the phrase "(no error)". This only happened in C::B(I'm gonna try Programmer's Notebook if this is actually the fault of C::B)

Though outside the IDE it's just spewing out the same error over and over again. The error in the actual program outside the IDE was *bypassed* when inside the IDE, only giving an Access Violation error(pre-update) or STD Exception(post-update)

> 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).

The program is pretty much finding the certificate as it's not the same error as not finding the file. It's just nagging at the fact that there maybe a path mistake(which can't be true since it's detecting it) and access rights(now how do I configure them access rights?)

> You can also try opening your pem file directly:
>
> auto pemFile = File("cacert.pem");

Unfortunately, HTTP.caInfo(); takes in a "const char[]" so I can't try that option.

> 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?

Thanks for the information however. :)