www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Make HTTP request without cURL/other libraries

reply "BoPoHa_C_CblPoM" <dolbobob.dolbobob gmail.com> writes:
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.
Sep 24 2014
next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Wednesday, 24 September 2014 at 16:45:57 UTC, BoPoHa_C_CblPoM 
wrote:
 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
Sep 24 2014
parent reply "BoPoHa_C_CblPoM" <dolbobob.dolbobob gmail.com> writes:
On Wednesday, 24 September 2014 at 16:58:33 UTC, Adam D. Ruppe
wrote:
 On Wednesday, 24 September 2014 at 16:45:57 UTC, 
 BoPoHa_C_CblPoM wrote:
 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
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.
Sep 24 2014
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Wednesday, 24 September 2014 at 17:48:25 UTC, BoPoHa_C_CblPoM 
wrote:
       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.
Sep 24 2014
parent "BoPoHa_C_CblPoM" <dolbobob.dolbobob gmail.com> writes:
On Wednesday, 24 September 2014 at 17:52:26 UTC, Adam D. Ruppe 
wrote:
 On Wednesday, 24 September 2014 at 17:48:25 UTC, 
 BoPoHa_C_CblPoM wrote:
      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.
Thank you again.
Sep 24 2014
prev sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Wednesday, 24 September 2014 at 16:45:57 UTC, BoPoHa_C_CblPoM 
wrote:
 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
Sep 25 2014