net: accept a NULL user agent in sceHttpCreateTemplate (Cyberpunk 2077)

This commit is contained in:
nmzik
2026-10-23 07:42:28 +02:00
parent f9e14084d6
commit 87e815b250
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -1,4 +1,5 @@
#include "common/abi.h"
#include "libs/network.h"
#include "loader/symbolDatabase.h"
#include <array>
@@ -162,6 +163,17 @@ void TestBuildHonoursOption(HttpUriParse parse, HttpUriBuild build) {
CHECK(BuildWith(build, element, 0) == url);
}
// Cyberpunk 2077 (PPSA03974) creates a template with a NULL user agent.
void TestTemplateWithoutUserAgent() {
using namespace Libs::Network;
Initialize();
const int pool = Net::NetPoolCreate("http", 0x10000, 0);
const int ssl = Ssl::SslInit(0x10000);
const int http = Http::HttpInit(pool, ssl, 0x10000);
CHECK(Http::HttpCreateTemplate(http, nullptr, 2, 1) > 0);
Shutdown();
}
} // namespace
int main() {
@@ -176,5 +188,6 @@ int main() {
TestAbsentQuery(parse);
TestEmptyUri(parse);
TestPresentQuery(parse);
TestTemplateWithoutUserAgent();
return failures == 0 ? 0 : 1;
}