Discussion:
Make HTTP request without cURL/other libraries
BoPoHa_C_CblPoM via Digitalmars-d
2014-09-24 16:45:54 UTC
Permalink
I just want to make request. Now i use cURL and his "get(url)"
function.
I want to make app smaller in size and in a single executable.

I need a good example for using std.socket. I read httpget.d from
samples folder, but i can't understand it.
Adam D. Ruppe via Digitalmars-d
2014-09-24 16:58:33 UTC
Permalink
On Wednesday, 24 September 2014 at 16:45:57 UTC, BoPoHa_C_CblPoM
Post by BoPoHa_C_CblPoM via Digitalmars-d
I just want to make request. Now i use cURL and his "get(url)"
function.
I want to make app smaller in size and in a single executable.
I need a good example for using std.socket. I read httpget.d
from samples folder, but i can't understand it.
The first 366 lines of this file do it with just std.socket and
optionally openssl:
https://github.com/adamdruppe/arsd/blob/master/http.d

The code is more complex than the samples folder thing but you
can just copy/paste that portion into your program and use the

string html = get("http://mysie.com/page");

function to run it
BoPoHa_C_CblPoM via Digitalmars-d
2014-09-24 17:48:24 UTC
Permalink
On Wednesday, 24 September 2014 at 16:58:33 UTC, Adam D. Ruppe
Post by Adam D. Ruppe via Digitalmars-d
On Wednesday, 24 September 2014 at 16:45:57 UTC,
Post by BoPoHa_C_CblPoM via Digitalmars-d
I just want to make request. Now i use cURL and his "get(url)"
function.
I want to make app smaller in size and in a single executable.
I need a good example for using std.socket. I read httpget.d
from samples folder, but i can't understand it.
The first 366 lines of this file do it with just std.socket and
https://github.com/adamdruppe/arsd/blob/master/http.d
The code is more complex than the samples folder thing but you
can just copy/paste that portion into your program and use the
string html = get("http://mysie.com/page");
function to run it
It's perfect libs, thank you!
But when i trying to make executable with:
dmd get.d
I get errors:
Error 42: Symbol Undefined _D4arsd4http3getFAyaHAyaAyaZAya
Error 42: Symbol Undefined _D4arsd4http12__ModuleInfoZ
What is this? I also trying to link program with winsock32.lib
from d compiller folder, but i get this errors too.
Adam D. Ruppe via Digitalmars-d
2014-09-24 17:52:25 UTC
Permalink
On Wednesday, 24 September 2014 at 17:48:25 UTC, BoPoHa_C_CblPoM
Post by BoPoHa_C_CblPoM via Digitalmars-d
Error 42: Symbol Undefined _D4arsd4http12__ModuleInfoZ
You imported the module, so you need to compile it too:

dmd yourfile.d http.d

where http.d is the download from my github, just save it in the
folder with the rest of your code.
BoPoHa_C_CblPoM via Digitalmars-d
2014-09-24 18:12:16 UTC
Permalink
On Wednesday, 24 September 2014 at 17:52:26 UTC, Adam D. Ruppe
Post by Adam D. Ruppe via Digitalmars-d
On Wednesday, 24 September 2014 at 17:48:25 UTC,
Post by BoPoHa_C_CblPoM via Digitalmars-d
Error 42: Symbol Undefined _D4arsd4http12__ModuleInfoZ
dmd yourfile.d http.d
where http.d is the download from my github, just save it in
the folder with the rest of your code.
Thank you again.
Vladimir Panteleev via Digitalmars-d
2014-09-26 00:09:30 UTC
Permalink
On Wednesday, 24 September 2014 at 16:45:57 UTC, BoPoHa_C_CblPoM
Post by BoPoHa_C_CblPoM via Digitalmars-d
I want to make app smaller in size and in a single executable.
If you only need Windows support, you can use the WinINet API,
this way you will not depend on cURL or OpenSSL:

https://github.com/CyberShadow/ae/blob/master/sys/net/wininet.d

Loading...