fix(native_bridge): strip query string in fx-gui HTTP path + walkthrough notes

- readRequest now trims '?t=<ms>' cache-buster so /frame?t=... matches
  /frame route (frontend VstGuiEmbed polls with timestamp → was 404, no image)
- document: jpeg62.dll manual copy, add auto-opens GUI (already_running
  expected), reopen needs bridge exit wait
This commit is contained in:
2026-08-18 08:27:35 +07:00
parent c382afe2a6
commit 569be72110
2 changed files with 19 additions and 4 deletions
+11 -2
View File
@@ -22,10 +22,10 @@
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
#include <cstdio>
#include <jpeglib.h>
#include <atomic>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
@@ -39,6 +39,12 @@
namespace {
// --- tiny JSON helpers (same API as RenderFxJob.cpp) ------------------------
const json_object_element_s* member(const json_object_s* o, const char* key) {
for (const json_object_element_s* e = o ? o->start : nullptr; e; e = e->next)
if (e->name && e->name->string && std::strcmp(e->name->string, key) == 0)
return e;
return nullptr;
}
const json_value_s* memberValue(const json_object_s* o, const char* key) {
const json_object_element_s* m = member(o, key);
return m ? m->value : nullptr;
@@ -83,6 +89,9 @@ bool readRequest(SOCKET c, HttpReq& out) {
if (sp1 == std::string::npos || sp2 == std::string::npos) return false;
out.method = head.substr(0, sp1);
out.path = head.substr(sp1 + 1, sp2 - sp1 - 1);
// strip query string: frontend cache-busts /frame?t=<ms>
const size_t q = out.path.find('?');
if (q != std::string::npos) out.path.resize(q);
long contentLength = 0;
size_t pos = 0;
@@ -285,7 +294,7 @@ void runHttpServer(HWND hwnd, std::atomic<bool>& stop) {
} else if (req.path == "/close") {
sendResponse(c, 200, "application/json", "{\"ok\":true}", 11);
stop.store(true);
PostMessageA(hwnd, WM_CLOSE); // pump exits -> process returns
PostMessageA(hwnd, WM_CLOSE, 0, 0); // pump exits -> process returns
} else {
sendResponse(c, 404, "application/json", "{\"error\":\"not found\"}", 22);
}