From b89adfc3b0880e55d9b997d971f05d2fa86b4d8d Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Thu, 12 May 2016 16:11:56 +0300 Subject: [PATCH] std.curl: document public methods --- std/net/curl.d | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/std/net/curl.d b/std/net/curl.d index f2e739a8e4d..85550724006 100644 --- a/std/net/curl.d +++ b/std/net/curl.d @@ -313,8 +313,6 @@ version(unittest) } version(StdDdoc) import std.stdio; -extern (C) void exit(int); - // Default data timeout for Protocols private enum _defaultDataTimeout = dur!"minutes"(2); @@ -1510,12 +1508,10 @@ private mixin template WorkerThreadProtocol(Unit, alias units) } } -// Workaround bug #2458 -// It should really be defined inside the byLineAsync method. -// Do not create instances of this struct since it will be -// moved when the bug has been fixed. +// @@@@BUG 15831@@@@ +// this should be inside byLineAsync // Range that reads one line at a time asynchronously. -static struct AsyncLineInputRange(Char) +private static struct AsyncLineInputRange(Char) { private Char[] line; mixin WorkerThreadProtocol!(Char, line); @@ -1539,7 +1535,6 @@ static struct AsyncLineInputRange(Char) } } - /** HTTP/FTP fetch content as a range of lines asynchronously. * * A range of lines is returned immediately and the request that fetches the @@ -1664,13 +1659,10 @@ unittest } } - -// Workaround bug #2458 -// It should really be defined inside the byLineAsync method. -// Do not create instances of this struct since it will be -// moved when the bug has been fixed. +// @@@@BUG 15831@@@@ +// this should be inside byLineAsync // Range that reads one chunk at a time asynchronously. -static struct AsyncChunkInputRange +private static struct AsyncChunkInputRange { private ubyte[] chunk; mixin WorkerThreadProtocol!(ubyte, chunk); @@ -2445,6 +2437,7 @@ struct HTTP return http; } + /// static HTTP opCall() { HTTP http; @@ -2452,6 +2445,7 @@ struct HTTP return http; } + /// HTTP dup() { HTTP copy; @@ -3183,6 +3177,7 @@ struct FTP return ftp; } + /// static FTP opCall() { FTP ftp; @@ -3190,6 +3185,7 @@ struct FTP return ftp; } + /// FTP dup() { FTP copy = FTP(); @@ -3524,6 +3520,7 @@ struct SMTP return smtp; } + /// static SMTP opCall() { SMTP smtp; @@ -3973,7 +3970,7 @@ struct Curl { alias OutData = void[]; alias InData = ubyte[]; - bool stopped; + private bool _stopped; private static auto ref curl() @property { return CurlAPI.instance; } @@ -4000,10 +3997,16 @@ struct Curl enforce!CurlException(!handle, "Curl instance already initialized"); handle = curl.easy_init(); enforce!CurlException(handle, "Curl instance couldn't be initialized"); - stopped = false; + _stopped = false; set(CurlOption.nosignal, 1); } + /// + @property bool stopped() const + { + return _stopped; + } + /** Duplicate this handle. @@ -4016,7 +4019,7 @@ struct Curl { Curl copy; copy.handle = curl.easy_duphandle(handle); - copy.stopped = false; + copy._stopped = false; with (CurlOption) { auto tt = AliasSeq!(file, writefunction, writeheader, @@ -4094,7 +4097,7 @@ struct Curl void shutdown() { throwOnStopped(); - stopped = true; + _stopped = true; curl.easy_cleanup(this.handle); this.handle = null; }