aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/depends/toolchain.cmake.in3
-rw-r--r--contrib/epee/include/net/http_client.h42
-rw-r--r--contrib/gitian/DOCKRUN.md2
-rw-r--r--contrib/gitian/README.md2
4 files changed, 21 insertions, 28 deletions
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
index c86012a6a..f118c754e 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -144,6 +144,9 @@ elseif(ARCHITECTURE STREQUAL "aarch64")
endif()
if(ARCHITECTURE STREQUAL "riscv64")
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(BUILD_TAG "linux-riscv64")
+ endif()
set(ARCH_ID "riscv64")
set(ARCH "rv64gc")
endif()
diff --git a/contrib/epee/include/net/http_client.h b/contrib/epee/include/net/http_client.h
index af1aee9f6..9ce30b620 100644
--- a/contrib/epee/include/net/http_client.h
+++ b/contrib/epee/include/net/http_client.h
@@ -245,18 +245,8 @@ namespace net_utils
}
}
- // This magic var determines the maximum length for when copying the body message in
- // memory is faster/more preferable than the round-trip time for one packet
- constexpr size_t BODY_NO_COPY_CUTOFF = 128 * 1024; // ~262 KB or ~175 packets
-
- // Maximum expected total headers bytes
- constexpr size_t HEADER_RESERVE_SIZE = 2048;
-
- const bool do_copy_body = body.size() <= BODY_NO_COPY_CUTOFF;
- const size_t req_buff_cap = HEADER_RESERVE_SIZE + (do_copy_body ? body.size() : 0);
-
std::string req_buff{};
- req_buff.reserve(req_buff_cap);
+ req_buff.reserve(2048);
req_buff.append(method.data(), method.size()).append(" ").append(uri.data(), uri.size()).append(" HTTP/1.1\r\n");
add_field(req_buff, "Host", m_host_buff);
add_field(req_buff, "Content-Length", std::to_string(body.size()));
@@ -265,7 +255,9 @@ namespace net_utils
for(const auto& field : additional_params)
add_field(req_buff, field);
+ for (unsigned sends = 0; sends < 2; ++sends)
{
+ const std::size_t initial_size = req_buff.size();
const auto auth = m_auth.get_auth_field(method, uri);
if (auth)
add_field(req_buff, *auth);
@@ -273,21 +265,11 @@ namespace net_utils
req_buff += "\r\n";
//--
- if (do_copy_body) // small body
- {
- // Copy headers + body together and potentially send one fewer packet
- req_buff.append(body.data(), body.size());
- const bool res = m_net_client.send(req_buff, timeout);
- CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
- }
- else // large body
- {
- // Send headers and body seperately to avoid copying heavy body message
- bool res = m_net_client.send(req_buff, timeout);
- CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
+ bool res = m_net_client.send(req_buff, timeout);
+ CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
+ if(body.size())
res = m_net_client.send(body, timeout);
- CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
- }
+ CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
m_response_info.clear();
m_state = reciev_machine_state_header;
@@ -300,11 +282,19 @@ namespace net_utils
return true;
}
- if (m_auth.handle_401(m_response_info) == http_client_auth::kParseFailure)
+ switch (m_auth.handle_401(m_response_info))
{
+ case http_client_auth::kSuccess:
+ break;
+ case http_client_auth::kBadPassword:
+ sends = 2;
+ break;
+ default:
+ case http_client_auth::kParseFailure:
LOG_ERROR("Bad server response for authentication");
return false;
}
+ req_buff.resize(initial_size); // rollback for new auth generation
}
LOG_ERROR("Client has incorrect username/password for server requiring authentication");
return false;
diff --git a/contrib/gitian/DOCKRUN.md b/contrib/gitian/DOCKRUN.md
index ef302c1e5..7994d39cc 100644
--- a/contrib/gitian/DOCKRUN.md
+++ b/contrib/gitian/DOCKRUN.md
@@ -57,7 +57,7 @@ The dockrun.sh script will do everything to build the binaries. Just specify the
version to build as its only argument, e.g.
```bash
-VERSION=v0.18.3.2
+VERSION=v0.18.3.3
./dockrun.sh $VERSION
```
diff --git a/contrib/gitian/README.md b/contrib/gitian/README.md
index 37346006a..6a97cbccb 100644
--- a/contrib/gitian/README.md
+++ b/contrib/gitian/README.md
@@ -133,7 +133,7 @@ Common setup part:
su - gitianuser
GH_USER=YOUR_GITHUB_USER_NAME
-VERSION=v0.18.3.2
+VERSION=v0.18.3.3
```
Where `GH_USER` is your GitHub user name and `VERSION` is the version tag you want to build.