summaryrefslogtreecommitdiff
path: root/LibCore/CHttpJob.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-05-28 11:53:16 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-28 17:31:20 +0200
commit0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425 (patch)
tree93dbbbeb714f258bd7fb044633eb83bdcd908286 /LibCore/CHttpJob.cpp
parentc11351ac507f863699d78aec46a77bd4d59e743c (diff)
downloadserenity-0dc9af5f7e26b0dfa42cb75c900b9ef7a2192425.zip
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
Diffstat (limited to 'LibCore/CHttpJob.cpp')
-rw-r--r--LibCore/CHttpJob.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/LibCore/CHttpJob.cpp b/LibCore/CHttpJob.cpp
index f9a9a08f3b..e580fd87c2 100644
--- a/LibCore/CHttpJob.cpp
+++ b/LibCore/CHttpJob.cpp
@@ -22,7 +22,7 @@ void CHttpJob::on_socket_connected()
bool success = m_socket->send(raw_request);
if (!success)
- return deferred_invoke([this](auto&){ did_fail(CNetworkJob::Error::TransmissionFailed); });
+ return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::TransmissionFailed); });
Vector<byte> buffer;
while (m_socket->is_connected()) {
@@ -33,18 +33,18 @@ void CHttpJob::on_socket_connected()
auto line = m_socket->read_line(PAGE_SIZE);
if (line.is_null()) {
printf("Expected HTTP status\n");
- return deferred_invoke([this](auto&){ did_fail(CNetworkJob::Error::TransmissionFailed); });
+ return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::TransmissionFailed); });
}
auto parts = String::copy(line, Chomp).split(' ');
if (parts.size() < 3) {
printf("Expected 3-part HTTP status, got '%s'\n", line.pointer());
- return deferred_invoke([this](auto&){ did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
}
bool ok;
m_code = parts[1].to_uint(ok);
if (!ok) {
printf("Expected numeric HTTP status\n");
- return deferred_invoke([this](auto&){ did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
}
m_state = State::InHeaders;
continue;
@@ -65,12 +65,12 @@ void CHttpJob::on_socket_connected()
auto parts = chomped_line.split(':');
if (parts.is_empty()) {
printf("Expected HTTP header with key/value\n");
- return deferred_invoke([this](auto&){ did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
}
auto name = parts[0];
if (chomped_line.length() < name.length() + 2) {
printf("Malformed HTTP header: '%s' (%d)\n", chomped_line.characters(), chomped_line.length());
- return deferred_invoke([this](auto&){ did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
}
auto value = chomped_line.substring(name.length() + 2, chomped_line.length() - name.length() - 2);
m_headers.set(name, value);
@@ -84,13 +84,13 @@ void CHttpJob::on_socket_connected()
m_state = State::Finished;
break;
}
- return deferred_invoke([this](auto&){ did_fail(CNetworkJob::Error::ProtocolFailed); });
+ return deferred_invoke([this](auto&) { did_fail(CNetworkJob::Error::ProtocolFailed); });
}
buffer.append(payload.pointer(), payload.size());
}
auto response = CHttpResponse::create(m_code, move(m_headers), ByteBuffer::copy(buffer.data(), buffer.size()));
- deferred_invoke([this, response] (auto&) {
+ deferred_invoke([this, response](auto&) {
did_finish(move(response));
});
}