Skip to content

Commit

Permalink
Merge pull request #114 from Geod24/fix-deprecations
Browse files Browse the repository at this point in the history
Fix upcoming deprecations (v2.091.0)
  • Loading branch information
ikod authored Feb 4, 2020
2 parents 03ecd3f + 2dce38a commit f62bf52
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions source/requests/pool.d
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ struct Route {
port = parsed.port;
}
bool opEquals(Route other) {
bool r = this.scheme == other.scheme
bool r = this.scheme == other.scheme
&& this.host == other.host
&& this.port == other.port;
return r;
}
bool opEquals(ref Route other) {
bool r = this.scheme == other.scheme
bool r = this.scheme == other.scheme
&& this.host == other.host
&& this.port == other.port;
return r;
Expand Down Expand Up @@ -278,7 +278,7 @@ public:
assert(_m._busy.length > 0 || _m._range.empty || _m._result.isNull);
assert(_m._busy.length + _m._idle.length <= _m._workers);
}
body
do
{
auto owner = thisTid();
Nullable!Tid idle;
Expand Down Expand Up @@ -319,7 +319,7 @@ public:
Job j = _m._range.front();
_m._range.popFront();
Route route = Route(j._url);
/*
/*
find best route.
1. look up for idle worker that served same route.
2. if 1. failed - look up for busy worker who server same route and have empty box
Expand All @@ -336,7 +336,7 @@ public:
if ( t in _m._idle ) {
debug(requests) tracef("found best for %s in idle %s", route, _m._idle[t]);
fromIdleToBusy(t, route);
} else
} else
if ( !idle.isNull ) {
debug(requests) tracef("use just released idle (prev job %s) for %s", _m._idle[t], route);
t = idle;
Expand Down Expand Up @@ -367,7 +367,7 @@ public:
out {
assert(_m._busy.length > 0 || _m._range.empty);
}
body {
do {
if ( !_m._result.isNull ) {
return _m._result;
}
Expand Down Expand Up @@ -481,4 +481,4 @@ version(None) unittest {
.each!(r => assert(r.code==200));
info("Testing pool - done");
}
}
}
26 changes: 13 additions & 13 deletions source/requests/server/httpd.d
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ else {
string[string] _cookies;
}
private mixin(Setter!(string[string])("requestHeaders"));
auto inout ref requestHeaders() @property @safe @nogc nothrow {
auto ref requestHeaders() inout @property @safe @nogc nothrow {
return _requestHeaders;
}
auto inout ref cookies() @property @safe @nogc nothrow {
auto ref cookies() inout @property @safe @nogc nothrow {
return _cookies;
}
private mixin(Setter!(string[string])("query"));
inout auto ref query() @property @safe @nogc nothrow {
auto ref query() inout @property @safe @nogc nothrow {
return _query;
}
inout auto ref requestBody() @property @safe @nogc nothrow {
auto ref requestBody() inout @property @safe @nogc nothrow {
return _requestBody;
}
private mixin(Setter!string("method"));
Expand Down Expand Up @@ -187,7 +187,7 @@ else {
}
///
/// raplace current front with another value
///
///
void unPop(ubyte[] data) {
assert(data.length > 0);
_content = data;
Expand All @@ -199,7 +199,7 @@ else {
/// return empty data if we receiving needle
/// if needle found in stream, then acc == needle
/// if end of stream happened, then eos = true
///
///
ubyte[] scanUntilR(string needle, ref ubyte[] acc, out bool eos) {
auto d = needle.representation;
ubyte[] l;
Expand Down Expand Up @@ -330,7 +330,7 @@ else {
ubyte[] _acc;
bool _done;
bool _eos;

this(_DataSource ds, string boundary) {
_ds = ds;
_boundary = "\r\n" ~ boundary;
Expand Down Expand Up @@ -364,7 +364,7 @@ else {
_DataSource _ds;
string[string] _headers;
string _boundary;

this(_DataSource ds, string[string] h, string boundary) {
_ds = ds;
_headers = h;
Expand Down Expand Up @@ -431,7 +431,7 @@ else {
auto skipHeaders() {
ubyte[] buf;
string[string] headers;

debug(httpd) tracef("Search for headers");
_ds.scanUntil("\r\n\r\n", delegate void (ubyte[] data) {
buf ~= data;
Expand All @@ -447,7 +447,7 @@ else {
/// Find boundary from request headers,
/// skip to begin of the first part,
/// create first part(read/parse headers, stop on the body begin)
///
///
this(HTTPD_Request rq) {
ubyte[] buf, rest;
string separator;
Expand Down Expand Up @@ -505,7 +505,7 @@ else {
foreach(p; parts) {
auto disposition = p.disposition;
auto data = p.data.joiner.array;

if ( !("name" in disposition) ) {
continue;
}
Expand Down Expand Up @@ -546,7 +546,7 @@ else {
};

auto response(C)(HTTPD_Request rq, C content, ushort code = 200)
if ( isSomeString!C
if ( isSomeString!C
|| (__traits(compiles, cast(ubyte[])content))
|| (__traits(compiles, cast(ubyte[])content.front))
)
Expand Down Expand Up @@ -1145,7 +1145,7 @@ else {
}
}


version(none) private unittest {
import std.json;
import std.conv;
Expand Down
2 changes: 1 addition & 1 deletion source/requests/streams.d
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ public abstract class SocketStream : NetworkStream {

ptrdiff_t send(const(void)[] buff)
in {assert(isConnected);}
body {
do {
auto rc = s.send(buff);
if (rc < 0) {
close();
Expand Down

0 comments on commit f62bf52

Please sign in to comment.