-
-
Notifications
You must be signed in to change notification settings - Fork 749
std.curl: document public methods #4314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
|
|
@@ -2445,13 +2437,15 @@ struct HTTP | |
| return http; | ||
| } | ||
|
|
||
| /// | ||
| static HTTP opCall() | ||
| { | ||
| HTTP http; | ||
| http.initialize(); | ||
| return http; | ||
| } | ||
|
|
||
| /// | ||
| HTTP dup() | ||
| { | ||
| HTTP copy; | ||
|
|
@@ -3183,13 +3177,15 @@ struct FTP | |
| return ftp; | ||
| } | ||
|
|
||
| /// | ||
| static FTP opCall() | ||
| { | ||
| FTP ftp; | ||
| ftp.initialize(); | ||
| 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; } | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment on previous PR
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. access is provided, see below. Though we might want to deprecate that.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need, I didn't see the function. Just mark it
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's already |
||
|
|
@@ -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; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until this struct is moved into byLineAsync, this comment should stay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bug is fixed, but afaik having struct outsides is currently better because it avoids the long names. Ideally we would disallow access to it, but that would be yet another deprecation cycle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the comment can be removed and this can be moved inside when https://issues.dlang.org/show_bug.cgi?id=15831 is fixed.
Maybe add this note:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as i understood 15831 it just increases the binary size and people are already working against this problem, so we don't need to let us be limited by this. What do other people think?
btw as this symbol wasn't documented and had an explicit warning against calling it, i think it's okay to set it private or move in the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not just that. Your link times also increase exponentially with the symbol sizes. Also, debugging with symbols that are > 2000 characters sucks.
People are working on compression of symbol names, which is a bandaid and not solution. You still end up with slower compile times, exponential symbol size, and an extra step to debugging.
Sure, set it to private, I'd argue that the above mentioned comment should be there as well.