Skip to content

Commit 59b077b

Browse files
committed
Quick test of naett's libcurl backend
1 parent 54379cd commit 59b077b

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ else()
240240
set(CoreLinkType STATIC)
241241
endif()
242242

243-
if(NOT ANDROID AND NOT WIN32 AND (NOT APPLE OR IOS))
243+
if(NOT ANDROID AND NOT WIN32 AND (NOT APPLE OR IOS) AND NOT LINUX)
244244
set(HTTPS_NOT_AVAILABLE ON)
245245
endif()
246246

@@ -2489,6 +2489,9 @@ endif()
24892489

24902490
if(NOT HTTPS_NOT_AVAILABLE)
24912491
target_link_libraries(${CoreLibName} naett)
2492+
if(LINUX AND NOT ANDROID)
2493+
target_link_libraries(${CoreLibName} curl)
2494+
endif()
24922495
endif()
24932496

24942497
target_compile_features(${CoreLibName} PUBLIC cxx_std_17)

Common/File/FileDescriptor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ bool WaitUntilReady(int fd, double timeout, bool for_write) {
9292
// Timeout.
9393
return false;
9494
} else {
95+
INFO_LOG(Log::IO, "WaitUntilReady succeeded");
9596
// Socket is ready.
9697
return true;
9798
}

Common/Net/HTTPClient.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ int Client::SendRequestWithData(const char *method, const RequestParams &req, st
345345
"Accept: %s\r\n"
346346
"Connection: close\r\n"
347347
"%s"
348-
"\r\n";
348+
"\r\n\r\n";
349349

350350
buffer.Printf(tpl,
351351
method, req.resource.c_str(), HTTP_VERSION,
@@ -354,8 +354,10 @@ int Client::SendRequestWithData(const char *method, const RequestParams &req, st
354354
req.acceptMime,
355355
otherHeaders ? otherHeaders : "");
356356
buffer.Append(data);
357+
357358
bool flushed = buffer.FlushSocket(sock(), dataTimeout_, progress->cancelled);
358359
if (!flushed) {
360+
WARN_LOG(Log::HTTP, "SendRequestWithData failed: resource: %s agent=%s", req.resource.c_str(), userAgent_.c_str());
359361
return -1; // TODO error code.
360362
}
361363
return 0;

Common/Net/NetBuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) {
4646
int sent = send(sock, &data[pos], end - pos, MSG_NOSIGNAL);
4747
// TODO: Do we need some retry logic here, instead of just giving up?
4848
if (sent < 0) {
49-
ERROR_LOG(Log::IO, "FlushSocket failed to send: %d", errno);
49+
ERROR_LOG(Log::IO, "FlushSocket failed to send: %d (%s)", errno, strerror(errno));
5050
return false;
5151
}
5252
pos += sent;

Core/RetroAchievements.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ void Initialize() {
618618
// Provide a logging function to simplify debugging
619619
rc_client_enable_logging(g_rcClient, RC_CLIENT_LOG_LEVEL_VERBOSE, log_message_callback);
620620
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
621+
INFO_LOG(Log::Achievements, "Falling back to HTTP host, no HTTPS support detected");
621622
// Disable SSL if not supported by our platform implementation.
622623
rc_client_set_host(g_rcClient, "http://retroachievements.org");
623624
}

0 commit comments

Comments
 (0)