Bug 18446 – Wrong curl onProgress examples

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-02-15T20:16:49Z
Last change time
2019-12-13T07:54:52Z
Keywords
bootcamp, pull
Assigned to
No Owner
Creator
Andre

Comments

Comment #0 by andre — 2018-02-15T20:16:49Z
https://dlang.org/phobos/std_net_curl.html#.HTTP.onProgress The example fails to compile because the mismatch ult <-> uln and also the return 0 statement is missing. import std.net.curl, std.stdio; auto client = HTTP("dlang.org"); client.onProgress = delegate int(size_t dl, size_t dln, size_t ul, size_t ult) { writeln("Progress: downloaded ", dln, " of ", dl); writeln("Progress: uploaded ", uln, " of ", ul); }; client.perform(); https://dlang.org/phobos/std_net_curl.html#.Curl.onProgress Also this example is wrong and parameters block looks not properly formatted. curl.perform should be outside the delegate. return 0 is missing. mismatch uln <-> ulnow import std.net.curl; Curl curl; curl.initialize(); curl.set(CurlOption.url, "http://dlang.org"); curl.onProgress = delegate int(size_t dltotal, size_t dlnow, size_t ultotal, size_t uln) { writeln("Progress: downloaded bytes ", dlnow, " of ", dltotal); writeln("Progress: uploaded bytes ", ulnow, " of ", ultotal); curl.perform(); };
Comment #1 by dlang-bot — 2019-12-12T12:40:09Z
@berni44 created dlang/phobos pull request #7317 "Fix Issue 18446 - Wrong curl onProgress examples" fixing this issue: - Fix Issue 18446 - Wrong curl onProgress examples https://github.com/dlang/phobos/pull/7317
Comment #2 by dlang-bot — 2019-12-13T07:54:52Z
dlang/phobos pull request #7317 "Fix Issue 18446 - Wrong curl onProgress examples" was merged into master: - 94ee73f71d276f83a844ba43b4b042164403fcb3 by Bernhard Seckinger: Fix Issue 18446 - Wrong curl onProgress examples https://github.com/dlang/phobos/pull/7317