Skip to content

Commit

Permalink
docs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ikod committed Jun 6, 2016
1 parent d8da1a9 commit 196a4eb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,5 @@ Usage example:


##### For Windows users
Requests distributed with binary ssl and crypto libraries. These libararies were downloaded from https://slproweb.com/products/Win32OpenSSL.html (full version) and converted using "implib /system" http://ftp.digitalmars.com/bup.zip.
If building or testing under windows fails with message about ssl, then inslall libssl32.lib and ssleay32.lib into dmd or ldc2 library path. You can find this libs on https://github.com/ikod/dlang-requests/tree/master/lib/win-i386. These libararies were downloaded from https://slproweb.com/products/Win32OpenSSL.html (full version) and converted using "implib /system" http://ftp.digitalmars.com/bup.zip.
If you know better way to link windows libraries, please, let me know.
2 changes: 1 addition & 1 deletion docs/http.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ <h3 class="memb">Members:</h3>
</p>
</div>
<h3 class="memb">Members:</h3>
<dl><dt class="decl"><p><code><a name="FiniteReadable.getSize"></a>abstract size_t <u>getSize</u>();
<dl><dt class="decl"><p><code><a name="FiniteReadable.getSize"></a>abstract ulong <u>getSize</u>();
</code></p></dt>
<dd class="decl desc"><div class="sections"><p>size of the content</p>
</div>
Expand Down
56 changes: 28 additions & 28 deletions docs/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,6 @@ <h2>Details</h2>
<u>Request</u> has methods get, post and exec which routed to proper concrete handler (http or ftp, etc).
To enable some protocol-specific featutes you have to use protocol interface directly (see docs for HTTPRequest or FTPRequest)</p>
<h4 class="sec">Examples:</h4> <p><pre class="d_code">
globalLogLevel(LogLevel.info);
info(<span style="color:red">"Test get in parallel"</span>);
<span style="color:blue">import</span> std.stdio;
<span style="color:blue">import</span> std.parallelism;
<span style="color:blue">import</span> std.algorithm;
<span style="color:blue">import</span> std.string;
<span style="color:blue">import</span> core.atomic;

<span style="color:blue">immutable</span> <span style="color:blue">auto</span> urls = [
<span style="color:red">"http://httpbin.org/stream/10"</span>,
<span style="color:red">"https://httpbin.org/stream/20"</span>,
<span style="color:red">"http://httpbin.org/stream/30"</span>,
<span style="color:red">"https://httpbin.org/stream/40"</span>,
<span style="color:red">"http://httpbin.org/stream/50"</span>,
<span style="color:red">"https://httpbin.org/stream/60"</span>,
<span style="color:red">"http://httpbin.org/stream/70"</span>,
];

defaultPoolThreads(5);

<span style="color:blue">shared</span> <span style="color:blue">short</span> lines;

<span style="color:blue">foreach</span>(url; parallel(urls)) {
atomicOp!<span style="color:red">"+="</span>(lines, getContent(url).splitter(<span style="color:red">"\n"</span>).count);
}
<span style="color:blue">assert</span>(lines == 287);
</pre>
</p><h4 class="sec">Examples:</h4> <p><pre class="d_code">
<span style="color:blue">import</span> std.algorithm;
<span style="color:blue">import</span> std.range;
<span style="color:blue">import</span> std.array;
Expand Down Expand Up @@ -509,6 +481,34 @@ <h4 class="sec">Examples:</h4> <p><pre class="d_code">
<span style="color:blue">int</span> age = 42;
r = <u>getContent</u>(<span style="color:red">"https://httpbin.org/get"</span>, <span style="color:red">"name"</span>, name, <span style="color:red">"age"</span>, age, <span style="color:red">"sex"</span>, sex);
</pre>
</p><h4 class="sec">Examples:</h4> <p><pre class="d_code">
globalLogLevel(LogLevel.info);
info(<span style="color:red">"Test get in parallel"</span>);
<span style="color:blue">import</span> std.stdio;
<span style="color:blue">import</span> std.parallelism;
<span style="color:blue">import</span> std.algorithm;
<span style="color:blue">import</span> std.string;
<span style="color:blue">import</span> core.atomic;

<span style="color:blue">immutable</span> <span style="color:blue">auto</span> urls = [
<span style="color:red">"http://httpbin.org/stream/10"</span>,
<span style="color:red">"https://httpbin.org/stream/20"</span>,
<span style="color:red">"http://httpbin.org/stream/30"</span>,
<span style="color:red">"https://httpbin.org/stream/40"</span>,
<span style="color:red">"http://httpbin.org/stream/50"</span>,
<span style="color:red">"https://httpbin.org/stream/60"</span>,
<span style="color:red">"http://httpbin.org/stream/70"</span>,
];

defaultPoolThreads(5);

<span style="color:blue">shared</span> <span style="color:blue">short</span> lines;

<span style="color:blue">foreach</span>(<i>url</i>; parallel(urls)) {
atomicOp!<span style="color:red">"+="</span>(lines, <u>getContent</u>(<i>url</i>).splitter(<span style="color:red">"\n"</span>).count);
}
<span style="color:blue">assert</span>(lines == 287);
</pre>
</p></div>
</dd>
<dt class="decl"><p><code><a name="postContent"></a>auto <u>postContent</u>(A...)(string <code><i>url</i></code>, A <code><i>args</i></code>);
Expand Down
58 changes: 29 additions & 29 deletions source/requests/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -131,35 +131,6 @@ struct Request {
}
}
///
package unittest {
globalLogLevel(LogLevel.info);
info("Test get in parallel");
import std.stdio;
import std.parallelism;
import std.algorithm;
import std.string;
import core.atomic;

immutable auto urls = [
"http://httpbin.org/stream/10",
"https://httpbin.org/stream/20",
"http://httpbin.org/stream/30",
"https://httpbin.org/stream/40",
"http://httpbin.org/stream/50",
"https://httpbin.org/stream/60",
"http://httpbin.org/stream/70",
];

defaultPoolThreads(5);

shared short lines;

foreach(url; parallel(urls)) {
atomicOp!"+="(lines, getContent(url).splitter("\n").count);
}
assert(lines == 287);
}
///
package unittest {
import std.algorithm;
import std.range;
Expand Down Expand Up @@ -442,6 +413,35 @@ package unittest {
int age = 42;
r = getContent("https://httpbin.org/get", "name", name, "age", age, "sex", sex);
}
///
package unittest {
globalLogLevel(LogLevel.info);
info("Test get in parallel");
import std.stdio;
import std.parallelism;
import std.algorithm;
import std.string;
import core.atomic;

immutable auto urls = [
"http://httpbin.org/stream/10",
"https://httpbin.org/stream/20",
"http://httpbin.org/stream/30",
"https://httpbin.org/stream/40",
"http://httpbin.org/stream/50",
"https://httpbin.org/stream/60",
"http://httpbin.org/stream/70",
];

defaultPoolThreads(5);

shared short lines;

foreach(url; parallel(urls)) {
atomicOp!"+="(lines, getContent(url).splitter("\n").count);
}
assert(lines == 287);
}

/**
* Call post and return response content.
Expand Down

0 comments on commit 196a4eb

Please sign in to comment.