Re: How to curl!

2018-05-02 Thread ikod via Digitalmars-d-learn
On Wednesday, 2 May 2018 at 16:58:35 UTC, IntegratedDimensions 
wrote:

On Wednesday, 2 May 2018 at 03:03:19 UTC, ikod wrote:
On Wednesday, 2 May 2018 at 00:04:49 UTC, IntegratedDimensions 
wrote:
On Tuesday, 1 May 2018 at 23:35:42 UTC, Arun Chandrasekaran 
wrote:

[...]


Ok, first try:

Unhandled exception: object.Exception can't complete call to 
TLS_method at requests\ssl_adapter.d(248)


which says it can't find the lib. I renamed ssleay32.dll to 
libssl32.dll and it then passed. I am getting http 404 error 
though ;/


I turned off cert though, which may be the reason, I have no 
idea. Seems to be working through.


Did you try to use full path to cacert.pem?


That seemed to work. Why would it not look in the current 
directory by default? Maybe something to add?


Not sure about curl, but dlang-requests just pass filename as-is 
to libssl. I think that if you have cert file in current 
directiry, and use no path in call to sslSetCertFile it should 
work. If not - please post bugreport to 
github.com/ikod/dlang-requests


PS. I'll check and add ssleay32 to search names for dynamic ssl 
library load.






Re: How to curl!

2018-05-02 Thread IntegratedDimensions via Digitalmars-d-learn

On Wednesday, 2 May 2018 at 03:03:19 UTC, ikod wrote:
On Wednesday, 2 May 2018 at 00:04:49 UTC, IntegratedDimensions 
wrote:
On Tuesday, 1 May 2018 at 23:35:42 UTC, Arun Chandrasekaran 
wrote:

[...]


Ok, first try:

Unhandled exception: object.Exception can't complete call to 
TLS_method at requests\ssl_adapter.d(248)


which says it can't find the lib. I renamed ssleay32.dll to 
libssl32.dll and it then passed. I am getting http 404 error 
though ;/


I turned off cert though, which may be the reason, I have no 
idea. Seems to be working through.


Did you try to use full path to cacert.pem?


That seemed to work. Why would it not look in the current 
directory by default? Maybe something to add?


Re: How to curl!

2018-05-01 Thread ikod via Digitalmars-d-learn
On Wednesday, 2 May 2018 at 00:04:49 UTC, IntegratedDimensions 
wrote:
On Tuesday, 1 May 2018 at 23:35:42 UTC, Arun Chandrasekaran 
wrote:
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions 
wrote:

[...]


std.net.curl is not quite up to date when compared to the curl 
command. It is not useful any non-trivial stuff. Right now I'm 
using ikod's dlang-requests[1] and I'm quite happy with it. I 
would recommend you to try it.


[1] https://github.com/ikod/dlang-requests


Ok, first try:

Unhandled exception: object.Exception can't complete call to 
TLS_method at requests\ssl_adapter.d(248)


which says it can't find the lib. I renamed ssleay32.dll to 
libssl32.dll and it then passed. I am getting http 404 error 
though ;/


I turned off cert though, which may be the reason, I have no 
idea. Seems to be working through.


Did you try to use full path to cacert.pem?


Re: How to curl!

2018-05-01 Thread IntegratedDimensions via Digitalmars-d-learn

On Tuesday, 1 May 2018 at 23:35:42 UTC, Arun Chandrasekaran wrote:
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions 
wrote:

Trying to curl basic stuff but std.net.curl isn't cooperating:
This is one of the reasons I hate D ;/ I've spent more time 
trying to get std.net.curl to do something that just works 
from the command line.


std.net.curl is not quite up to date when compared to the curl 
command. It is not useful any non-trivial stuff. Right now I'm 
using ikod's dlang-requests[1] and I'm quite happy with it. I 
would recommend you to try it.


[1] https://github.com/ikod/dlang-requests


Ok, first try:

Unhandled exception: object.Exception can't complete call to 
TLS_method at requests\ssl_adapter.d(248)


which says it can't find the lib. I renamed ssleay32.dll to 
libssl32.dll and it then passed. I am getting http 404 error 
though ;/


I turned off cert though, which may be the reason, I have no 
idea. Seems to be working through.


Re: How to curl!

2018-05-01 Thread IntegratedDimensions via Digitalmars-d-learn

On Tuesday, 1 May 2018 at 23:02:39 UTC, Dr.No wrote:
On Tuesday, 1 May 2018 at 22:51:01 UTC, IntegratedDimensions 
wrote:

[...]

those dlls:
libeay32.dll libssl32.dll ssleay32.dll

I'm sure they would be installed with whatever

[...]


I don't think so. IIRC, when I used D+curl I needed to download 
them manutally. This is always the case with Qt. Even using 
windeployqt with   --webkit2 flag I still need to copy those 
dlls to application binary folder.



[...]



It isn't always the case if the dll is dynamic loaded, it might 
fail quietly, for example, if you deploy an Qt application with 
QWebKit missing those Open SSL dlls, an page with https 
protocol just doesn't open and didn't show any error at all. To 
find out whether some referenced dll by your executable is 
missing, people use Dependence Walker: 
http://www.dependencywalker.com/


I don't think this is the problem.

If I use get on https://www.google.com it works fine but if I use 
get on https://www.googleapis.com/youtube/v3/channels it fails


so it is site dependent.



Re: How to curl!

2018-05-01 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions 
wrote:

Trying to curl basic stuff but std.net.curl isn't cooperating:
This is one of the reasons I hate D ;/ I've spent more time 
trying to get std.net.curl to do something that just works from 
the command line.


std.net.curl is not quite up to date when compared to the curl 
command. It is not useful any non-trivial stuff. Right now I'm 
using ikod's dlang-requests[1] and I'm quite happy with it. I 
would recommend you to try it.


[1] https://github.com/ikod/dlang-requests


Re: How to curl!

2018-05-01 Thread Dr.No via Digitalmars-d-learn
On Tuesday, 1 May 2018 at 22:51:01 UTC, IntegratedDimensions 
wrote:

On Tuesday, 1 May 2018 at 22:08:50 UTC, Dr.No wrote:
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions 
wrote:

Trying to curl basic stuff but std.net.curl isn't cooperating:

curl "https://www.googleapis.com/youtube/v3/channels; -G -d 
part=contentDetails -d forUsername=test -d key=somekey


[...]


Just a wild guess, do you have the SSL dlls in the same folder 
as your executable or (less likely) in your PATH?



What SSL dlls?

those dlls:
libeay32.dll libssl32.dll ssleay32.dll

I'm sure they would be installed with whatever

installation uses them.


I don't think so. IIRC, when I used D+curl I needed to download 
them manutally. This is always the case with Qt. Even using 
windeployqt with   --webkit2 flag I still need to copy those dlls 
to application binary folder.


ssleay32.dll comes with dmd2 and it is in the path, if that is 
what you are talking about. If a dll was missing though and 
that was the problem then it needs to state that it is a 
missing dll rather than some other issue.



It isn't always the case if the dll is dynamic loaded, it might 
fail quietly, for example, if you deploy an Qt application with 
QWebKit missing those Open SSL dlls, an page with https protocol 
just doesn't open and didn't show any error at all. To find out 
whether some referenced dll by your executable is missing, people 
use Dependence Walker: http://www.dependencywalker.com/







Re: How to curl!

2018-05-01 Thread IntegratedDimensions via Digitalmars-d-learn

On Tuesday, 1 May 2018 at 22:08:50 UTC, Dr.No wrote:
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions 
wrote:

Trying to curl basic stuff but std.net.curl isn't cooperating:

curl "https://www.googleapis.com/youtube/v3/channels; -G -d 
part=contentDetails -d forUsername=test -d key=somekey


[...]


Just a wild guess, do you have the SSL dlls in the same folder 
as your executable or (less likely) in your PATH?



What SSL dlls? I'm sure they would be installed with whatever 
installation uses them.


ssleay32.dll comes with dmd2 and it is in the path, if that is 
what you are talking about. If a dll was missing though and that 
was the problem then it needs to state that it is a missing dll 
rather than some other issue.


Re: How to curl!

2018-05-01 Thread Dr.No via Digitalmars-d-learn
On Tuesday, 1 May 2018 at 21:57:22 UTC, IntegratedDimensions 
wrote:

Trying to curl basic stuff but std.net.curl isn't cooperating:

curl "https://www.googleapis.com/youtube/v3/channels; -G -d 
part=contentDetails -d forUsername=test -d key=somekey


[...]


Just a wild guess, do you have the SSL dlls in the same folder as 
your executable or (less likely) in your PATH?