fix: 按 Grok 评审修复 Repeater 录制代理地址、数字主机 SSRF、Cookie 合并等问题(Codex gpt-6.1-sol)(#42)

This commit is contained in:
RuoJi6 committed 2026-10-24 22:46:37 +08:00
1 parent 1847b8adb1
commit ddfdc36787
5 files changed
+180 -8

No files matched your search

+10 -3
View File
@@ -45,9 +45,15 @@ export function parseHeadersText(text: string): Record<string, string> {
const name = line.slice(0, separator).trim();
const value = line.slice(separator + 1).trim();
if (!name) continue;
// The API accepts one value per name. Combining duplicates preserves the
// common comma-separated-header semantics for this MVP.
result[name] = result[name] ? `${result[name]}, ${value}` : value;
// The API accepts one value per name. Cookies use semicolon separators;
// other duplicate headers preserve the common comma-separated semantics.
const existingName = Object.keys(result).find((item) => item.toLowerCase() === name.toLowerCase());
if (!existingName) {
result[name] = value;
} else {
const separator = existingName.toLowerCase() === "cookie" ? "; " : ", ";
result[existingName] = `${result[existingName]}${separator}${value}`;
}
}
return result;
}
@@ -224,6 +230,7 @@ export function FindingRepeaterDialog({
<button
key={entry.id}
type="button"
disabled={busy}
className="block w-full rounded-md px-2 py-1.5 text-left hover:bg-muted"
onClick={() => {
setMethod(entry.method);
+18
View File
@@ -1012,6 +1012,24 @@ export async function mockHandle<T>(method: string, rawPath: string, body?: Body
function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Record<string, unknown>): unknown {
const task = q.get("task") ?? undefined;
// The demo client still expects the complete repeater response shape. No
// network request is made in mock mode, but returning the shape keeps the
// dialog's status/body counters safe for every method.
if (path === "/repeater/send" && m === "POST") {
const responseBody = "(演示模式)未发送真实请求。";
return {
status: 200,
status_text: "200 OK",
proto: "HTTP/1.1",
headers: { "Content-Type": ["text/plain; charset=utf-8"] },
body: responseBody,
body_truncated: false,
body_bytes: new TextEncoder().encode(responseBody).length,
elapsed_ms: 0,
url: String(b.url ?? ""),
};
}
if (path === "/chat/mentions" && m === "GET") {
const kind = q.get("kind") ?? "";
const query = (q.get("q") ?? "").trim().toLowerCase();