Lines Matching full:curl

26 You may need to link to the $(B curl) library, e.g. by adding $(D "libs": ["curl"])
97 import std.net.curl, std.stdio;
123 import std.net.curl, std.stdio;
157 module std.net.curl;
160 import etc.c.curl;
172 public import etc.c.curl : CurlOption;
366 * import std.net.curl;
392 // Is true if the Conn type is a valid Curl Connection type.
409 * import std.net.curl;
465 * import std.net.curl;
542 * import std.net.curl;
612 * import std.net.curl;
705 * import std.net.curl;
764 * import std.net.curl;
832 * import std.net.curl;
876 * import std.net.curl;
917 * import std.net.curl;
1053 // As of curl 7.18.0, libcurl will not pass in _basicHTTP()
1260 * import std.net.curl, std.stdio;
1369 * import std.net.curl, std.stdio;
1457 curl protocols.
1626 * import std.net.curl, std.stdio;
1639 * import std.net.curl, std.stdio;
1779 * import std.net.curl, std.stdio;
1792 * import std.net.curl, std.stdio;
1921 connDup.p.curl.handle = null; // make sure handle is not freed in _asyncDuplicateConnection()
1925 Mixin template for all supported curl protocols. This is the commom
1944 The curl handle used by this connection. in Protocol()
1946 @property ref Curl handle() return in Protocol()
1948 return p.curl; in Protocol()
1956 return p.curl.stopped; in Protocol()
1962 p.curl.shutdown(); in Protocol()
1970 p.curl.set(CurlOption.verbose, on ? 1L : 0L); in Protocol()
1978 p.curl.set(CurlOption.low_speed_limit, 1); in Protocol()
1979 p.curl.set(CurlOption.low_speed_time, d.total!"seconds"); in Protocol()
1987 p.curl.set(CurlOption.timeout_ms, d.total!"msecs"); in Protocol()
1993 p.curl.set(CurlOption.connecttimeout_ms, d.total!"msecs"); in Protocol()
1999 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy) in Protocol()
2003 p.curl.set(CurlOption.proxy, host); in Protocol()
2007 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXYPORT, _proxy_port) in Protocol()
2011 p.curl.set(CurlOption.proxyport, cast(long) port); in Protocol()
2015 alias CurlProxy = etc.c.curl.CurlProxy; in Protocol()
2018 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy_type) in Protocol()
2022 p.curl.set(CurlOption.proxytype, cast(long) type); in Protocol()
2028 p.curl.set(CurlOption.dns_cache_timeout, d.total!"msecs"); in Protocol()
2044 p.curl.set(CurlOption.intrface, i); in Protocol()
2068 p.curl.set(CurlOption.localport, cast(long) port); in Protocol()
2079 p.curl.set(CurlOption.noproxy, hosts); in Protocol()
2091 p.curl.set(CurlOption.localportrange, cast(long) range); in Protocol()
2095 See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTTCPNODELAY, nodelay) in Protocol()
2099 p.curl.set(CurlOption.tcp_nodelay, cast(long) (on ? 1 : 0) ); in Protocol()
2103 See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTSSLVERIFYPEER, verifypeer) in Protocol()
2107 p.curl.set(CurlOption.ssl_verifypeer, on ? 1 : 0); in Protocol()
2111 See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTSSLVERIFYHOST, verifypeer) in Protocol()
2115 p.curl.set(CurlOption.ssl_verifyhost, on ? 2 : 0); in Protocol()
2139 p.curl.set(CurlOption.userpwd, format("%s:%s", username, password)); in Protocol()
2174 p.curl.set(CurlOption.proxyuserpwd, in Protocol()
2196 * import std.net.curl; in Protocol()
2213 p.curl.clear(CurlOption.postfields); // cannot specify data when using callback in Protocol()
2214 p.curl.onSend = callback; in Protocol()
2230 * import std.net.curl, std.stdio; in Protocol()
2242 p.curl.onReceive = callback; in Protocol()
2260 * import std.net.curl, std.stdio; in Protocol()
2273 p.curl.onProgress = callback; in Protocol()
2378 * import std.net.curl, std.stdio;
2424 /// Authentication method equal to $(REF CurlAuth, etc,c,curl)
2434 Curl.curl.slist_free_all(headersOut); in ~this()
2435 if (curl.handle !is null) // work around RefCounted/emplace bug in ~this()
2436 curl.shutdown(); in ~this()
2438 Curl curl; member
2503 curl.onReceiveHeader = dg; in onReceiveHeader()
2509 /// Parse status line, as received from / generated by cURL.
2535 // The HTTP2 protocol is binary; cURL generates this fake text header.
2540 /** Time condition enumeration as an alias of $(REF CurlTimeCond, etc,c,curl)
2575 newlist = Curl.curl.slist_append(newlist, cur.data); in dup()
2579 copy.p.curl.set(CurlOption.httpheader, copy.p.headersOut); in dup()
2580 copy.p.curl = p.curl.dup(); in dup()
2588 p.curl.initialize(); in initialize()
2617 p.curl.set(CurlOption.nobody, 1L);
2622 p.curl.set(CurlOption.httpget, 1L);
2626 p.curl.set(CurlOption.post, 1L);
2630 p.curl.set(CurlOption.upload, 1L);
2634 p.curl.set(CurlOption.customrequest, "DELETE");
2638 p.curl.set(CurlOption.customrequest, "OPTIONS");
2642 p.curl.set(CurlOption.customrequest, "TRACE");
2646 p.curl.set(CurlOption.customrequest, "CONNECT");
2650 p.curl.set(CurlOption.customrequest, "PATCH");
2655 scope (exit) p.curl.clear(opt);
2656 return p.curl.perform(throwOnError);
2666 p.curl.set(CurlOption.url, url); in url()
2672 p.curl.set(CurlOption.cainfo, caFile); in caInfo()
2715 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy) in version()
2720 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXYPORT, _proxy_port) in version()
2725 alias CurlProxy = etc.c.curl.CurlProxy; in version()
2728 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy_type) in version()
2771 See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTTCPNODELAY, nodelay) in version()
2817 * import std.net.curl; in version()
2847 * import std.net.curl, std.stdio; in version()
2871 * import std.net.curl, std.stdio; in version()
2890 Curl.curl.slist_free_all(p.headersOut); in clearRequestHeaders()
2892 p.curl.clear(CurlOption.httpheader); in clearRequestHeaders()
2902 * import std.net.curl;
2916 p.headersOut = Curl.curl.slist_append(p.headersOut, in addRequestHeader()
2918 p.curl.set(CurlOption.httpheader, p.headersOut); in addRequestHeader()
2923 * It has the form "Phobos-std.net.curl/$(I PHOBOS_VERSION) (libcurl/$(I CURL_VERSION))"
2930 // http://curl.haxx.se/docs/versions.html in defaultUserAgent()
2931 enum fmt = "Phobos-std.net.curl/%d.%03d (libcurl/%d.%d.%d)"; in defaultUserAgent()
2939 auto curlVer = Curl.curl.version_info(CURLVERSION_NOW).version_num; in defaultUserAgent()
2955 p.curl.set(CurlOption.useragent, userAgent); in setUserAgent()
2959 * Get various timings defined in $(REF CurlInfo, etc, c, curl).
2960 * The value is usable only if the return value is equal to $(D etc.c.curl.CurlError.ok).
2963 * timing = one of the timings defined in $(REF CurlInfo, etc, c, curl).
2965 * $(D etc.c.curl.CurlInfo.namelookup_time),
2966 * $(D etc.c.curl.CurlInfo.connect_time),
2967 * $(D etc.c.curl.CurlInfo.pretransfer_time),
2968 * $(D etc.c.curl.CurlInfo.starttransfer_time),
2969 * $(D etc.c.curl.CurlInfo.redirect_time),
2970 * $(D etc.c.curl.CurlInfo.appconnect_time),
2971 * $(D etc.c.curl.CurlInfo.total_time).
2976 * should be used only if the return value is $(D etc.c.curl.CurlInfo.ok).
2980 * import std.net.curl;
2981 * import etc.c.curl : CurlError, CurlInfo;
2995 return p.curl.getTiming(timing, val); in getTiming()
3030 p.curl.set(CurlOption.cookie, cookie); in setCookie()
3036 p.curl.set(CurlOption.cookiefile, path); in setCookieJar()
3038 p.curl.set(CurlOption.cookiejar, path); in setCookieJar()
3044 p.curl.set(CurlOption.cookielist, "FLUSH"); in flushCookieJar()
3050 p.curl.set(CurlOption.cookielist, "SESS"); in clearSessionCookies()
3056 p.curl.set(CurlOption.cookielist, "ALL"); in clearAllCookies()
3070 p.curl.set(CurlOption.timecondition, cond);
3071 p.curl.set(CurlOption.timevalue, timestamp.toUnixTime());
3082 * import std.net.curl, std.stdio;
3101 * import std.net.curl, std.stdio;
3123 * import std.net.curl;
3134 p.curl.clear(CurlOption.readfunction); in setPostData()
3136 p.curl.set(CurlOption.postfields, cast(void*) data.ptr); in setPostData()
3137 p.curl.set(CurlOption.postfieldsize, data.length); in setPostData()
3173 * import std.net.curl, std.stdio;
3231 p.curl.set(lenOpt, to!curl_off_t(len)); in contentLength()
3240 p.curl.set(CurlOption.httpauth, cast(long) authMethod); in authenticationMethod()
3252 p.curl.set(CurlOption.followlocation, 0); in maxRedirects()
3256 p.curl.set(CurlOption.followlocation, 1); in maxRedirects()
3257 p.curl.set(CurlOption.maxredirs, maxRedirs); in maxRedirects()
3365 Curl.curl.slist_free_all(commands); in ~this()
3366 if (curl.handle !is null) // work around RefCounted/emplace bug in ~this()
3367 curl.shutdown(); in ~this()
3370 Curl curl; member
3401 copy.p.curl = p.curl.dup(); in dup()
3406 newlist = Curl.curl.slist_append(newlist, cur.data); in dup()
3410 copy.p.curl.set(CurlOption.postquote, copy.p.commands); in dup()
3417 p.curl.initialize(); in initialize()
3434 return p.curl.perform(throwOnError);
3445 p.curl.set(CurlOption.url, url); in url()
3488 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy) in version()
3493 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXYPORT, _proxy_port) in version()
3498 alias CurlProxy = etc.c.curl.CurlProxy; in version()
3501 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy_type) in version()
3544 See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTTCPNODELAY, nodelay) in version()
3624 Curl.curl.slist_free_all(p.commands); in clearCommands()
3626 p.curl.clear(CurlOption.postquote); in clearCommands()
3636 * import std.net.curl;
3645 p.commands = Curl.curl.slist_append(p.commands, in addCommand()
3647 p.curl.set(CurlOption.postquote, p.commands); in addCommand()
3668 p.curl.set(CurlOption.infilesize_large, to!curl_off_t(len)); in contentLength()
3672 * Get various timings defined in $(REF CurlInfo, etc, c, curl).
3673 * The value is usable only if the return value is equal to $(D etc.c.curl.CurlError.ok).
3676 * timing = one of the timings defined in $(REF CurlInfo, etc, c, curl).
3678 * $(D etc.c.curl.CurlInfo.namelookup_time),
3679 * $(D etc.c.curl.CurlInfo.connect_time),
3680 * $(D etc.c.curl.CurlInfo.pretransfer_time),
3681 * $(D etc.c.curl.CurlInfo.starttransfer_time),
3682 * $(D etc.c.curl.CurlInfo.redirect_time),
3683 * $(D etc.c.curl.CurlInfo.appconnect_time),
3684 * $(D etc.c.curl.CurlInfo.total_time).
3689 * should be used only if the return value is $(D etc.c.curl.CurlInfo.ok).
3693 * import std.net.curl;
3694 * import etc.c.curl : CurlError, CurlInfo;
3710 return p.curl.getTiming(timing, val); in getTiming()
3742 * import std.net.curl;
3763 if (curl.handle !is null) // work around RefCounted/emplace bug in ~this()
3764 curl.shutdown(); in ~this()
3766 Curl curl; member
3776 curl.onSend = delegate size_t(void[] data) in message()
3814 copy.p.curl = p.curl.dup();
3819 newlist = Curl.curl.slist_append(newlist, cur.data);
3823 copy.p.curl.set(CurlOption.postquote, copy.p.commands);
3836 return p.curl.perform(throwOnError);
3849 p.curl.set(CurlOption.use_ssl, CurlUseSSL.all); in url()
3856 p.curl.set(CurlOption.url, url); in url()
3861 p.curl.initialize(); in initialize()
3862 p.curl.set(CurlOption.upload, 1L); in initialize()
3908 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy) in version()
3913 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXYPORT, _proxy_port) in version()
3918 alias CurlProxy = etc.c.curl.CurlProxy; in version()
3921 * See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPROXY, _proxy_type) in version()
3964 See: $(HTTP curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTTCPNODELAY, nodelay) in version()
4043 p.curl.set(CurlOption.mail_from, sender); in mailFrom()
4056 Curl.curl.slist_append(recipients_list, in mailTo()
4059 p.curl.set(CurlOption.mail_rcpt, recipients_list); in mailTo()
4073 Exception thrown on errors in std.net.curl functions.
4095 Exception thrown on timeout errors in std.net.curl functions.
4143 /// Equal to $(REF CURLcode, etc,c,curl)
4159 CURL* function() easy_init;
4160 CURLcode function(CURL *curl, CURLoption option,...) easy_setopt;
4161 CURLcode function(CURL *curl) easy_perform;
4162 CURLcode function(CURL *curl, CURLINFO info,...) easy_getinfo;
4163 CURL* function(CURL *curl) easy_duphandle;
4165 CURLcode function(CURL *handle, int bitmask) easy_pause;
4166 void function(CURL *curl) easy_cleanup;
4203 // try to load curl from the executable to allow static linking in loadAPI()
4218 static immutable names = ["libcurl.dll", "curl.dll"]; in loadAPI()
4229 … enforce!CurlException(handle !is null, "Failed to load curl, tried %(%s, %).".format(names)); in loadAPI()
4277 when passing Curl to other functions. Otherwise always allocate on
4280 struct Curl
4286 private static auto ref curl() @property { return CurlAPI.instance; } in curl() function
4289 private CURL* handle;
4304 Initialize the instance by creating a working curl handle.
4308 enforce!CurlException(!handle, "Curl instance already initialized"); in initialize()
4309 handle = curl.easy_init(); in initialize()
4310 enforce!CurlException(handle, "Curl instance couldn't be initialized"); in initialize()
4329 Curl dup() in dup()
4331 Curl copy; in dup()
4332 copy.handle = curl.easy_duphandle(handle); in dup()
4355 // Enable for curl version > 7.21.7 in dup()
4393 auto msgZ = curl.easy_strerror(code); in errorString()
4400 auto def = "Curl instance called after being cleaned up";
4406 Stop and invalidate this curl instance.
4413 curl.easy_cleanup(this.handle); in shutdown()
4423 _check(curl.easy_pause(this.handle, in pause()
4429 Set a string curl option.
4431 option = A $(REF CurlOption, etc,c,curl) as found in the curl documentation
4437 _check(curl.easy_setopt(this.handle, option, value.tempCString().buffPtr)); in set()
4441 Set a long curl option.
4443 option = A $(REF CurlOption, etc,c,curl) as found in the curl documentation
4449 _check(curl.easy_setopt(this.handle, option, value)); in set()
4453 Set a void* curl option.
4455 option = A $(REF CurlOption, etc,c,curl) as found in the curl documentation
4461 _check(curl.easy_setopt(this.handle, option, value)); in set()
4467 option = A $(REF CurlOption, etc,c,curl) as found in the curl documentation
4472 _check(curl.easy_setopt(this.handle, option, null)); in clear()
4479 option = A $(REF CurlOption, etc,c,curl) as found in the curl documentation
4484 auto rval = curl.easy_setopt(this.handle, option, null); in clearIfSupported()
4490 perform the curl request by doing the HTTP,FTP etc. as it has
4499 CurlCode code = curl.easy_perform(this.handle);
4509 $(D etc.c.curl.CurlError.ok).
4514 code = curl.easy_getinfo(handle, timing, &val); in getTiming()
4534 * import std.net.curl, std.stdio;
4535 * Curl curl;
4536 * curl.initialize();
4537 * curl.set(CurlOption.url, "http://dlang.org");
4538 …* curl.onReceive = (ubyte[] data) { writeln("Got data", to!(const(char)[])(data)); return data.len…
4539 * curl.perform();
4546 throwOnStopped("Receive callback called on cleaned up Curl instance"); in onReceive()
4550 set(CurlOption.writefunction, cast(void*) &Curl._receiveCallback); in onReceive()
4565 * import std.net.curl, std.stdio;
4566 * Curl curl;
4567 * curl.initialize();
4568 * curl.set(CurlOption.url, "http://dlang.org");
4569 * curl.onReceiveHeader = (in char[] header) { writeln(header); };
4570 * curl.perform();
4578 "cleaned up Curl instance"); in onReceiveHeader()
4583 cast(void*) &Curl._receiveHeaderCallback); in onReceiveHeader()
4595 * The special value $(D Curl.abortRequest) can be returned in
4597 * The special value $(D Curl.pauseRequest) can be returned in order to
4602 * import std.net.curl;
4603 * Curl curl;
4604 * curl.initialize();
4605 * curl.set(CurlOption.url, "http://dlang.org");
4608 * curl.onSend = (void[] data)
4617 * curl.perform();
4624 throwOnStopped("Send callback called on cleaned up Curl instance"); in onSend()
4628 set(CurlOption.readfunction, cast(void*) &Curl._sendCallback); in onSend()
4632 * The event handler that gets called when the curl backend needs to seek
4637 * $(REF CurlSeekPos, etc,c,curl)
4641 * $(REF CurlSeek, etc,c,curl)
4645 * import std.net.curl;
4646 * Curl curl;
4647 * curl.initialize();
4648 * curl.set(CurlOption.url, "http://dlang.org");
4649 * curl.onSeek = (long p, CurlSeekPos sp)
4653 * curl.perform();
4660 throwOnStopped("Seek callback called on cleaned up Curl instance"); in onSeek()
4664 set(CurlOption.seekfunction, cast(void*) &Curl._seekCallback); in onSeek()
4674 * $(REF CurlSockType, etc,c,curl)
4678 * and make curl close the socket
4682 * import std.net.curl;
4683 * Curl curl;
4684 * curl.initialize();
4685 * curl.set(CurlOption.url, "http://dlang.org");
4686 * curl.onSocketOption = delegate int(curl_socket_t s, CurlSockType t) { /+ do stuff +/ };
4687 * curl.perform();
4696 "cleaned up Curl instance"); in onSocketOption()
4701 cast(void*) &Curl._socketOptionCallback); in onSocketOption()
4718 * import std.net.curl;
4719 * Curl curl;
4720 * curl.initialize();
4721 * curl.set(CurlOption.url, "http://dlang.org");
4722 * curl.onProgress = delegate int(size_t dltotal, size_t dlnow, size_t ultotal, size_t uln)
4726 * curl.perform();
4738 "up Curl instance"); in onProgress()
4743 set(CurlOption.progressfunction, cast(void*) &Curl._progressCallback); in onProgress()
4751 auto b = cast(Curl*) ptr; in _receiveCallback()
4763 auto b = cast(Curl*) ptr; in _receiveHeaderCallback()
4774 Curl* b = cast(Curl*) ptr; in _sendCallback()
4784 auto b = cast(Curl*) ptr; in _seekCallback()
4797 auto b = cast(Curl*) ptr; in _socketOptionCallback()
4810 auto b = cast(Curl*) ptr; in _progressCallback()
5080 auto connDup = cast(CURL*) receiveOnly!ulong();
5082 client.p.curl.handle = connDup;
5137 new CurlException(client.p.curl.errorString(code)));