Skip to content

Commit

Permalink
websocket fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaloupka committed Aug 24, 2019
1 parent dcb3897 commit eebf950
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions http/vibe/http/client.d
Original file line number Diff line number Diff line change
Expand Up @@ -557,19 +557,19 @@ final class HTTPClient {
scope (failure) {
m_responding = false;
disconnect();
break;
}
try responder(res);
catch (Exception e) {
logDebug("Error while handling response: %s", e.toString().sanitize());
user_exception = e;
}
if (res.statusCode < 200)
{
if (res.statusCode < 200) {
// just an informational status -> read and handle next response
if (m_responding) res.dropBody();
res = scoped!HTTPClientResponse(this, has_body, close_conn, request_allocator, connected_time);
continue;
if (m_conn) {
res = scoped!HTTPClientResponse(this, has_body, close_conn, request_allocator, connected_time);
continue;
}
}
if (m_responding) {
logDebug("Failed to handle the complete response of the server - disconnecting.");
Expand Down
2 changes: 2 additions & 0 deletions http/vibe/http/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,7 @@ final class HTTPServerResponse : HTTPResponse {
if (protocol.length) headers["Upgrade"] = protocol;
writeVoidBody();
m_requiresConnectionClose = true;
m_headerWritten = true;
return createConnectionProxyStream(m_conn, m_rawConnection);
}
/// ditto
Expand All @@ -1548,6 +1549,7 @@ final class HTTPServerResponse : HTTPResponse {
if (protocol.length) headers["Upgrade"] = protocol;
writeVoidBody();
m_requiresConnectionClose = true;
m_headerWritten = true;
() @trusted {
auto conn = createConnectionProxyStreamFL(m_conn, m_rawConnection);
del(conn);
Expand Down

0 comments on commit eebf950

Please sign in to comment.