fix: Array move ownership, selfhost -g flags, LSP workspace/symbol
Session 36: prevent UAF when Array is moved into a struct field (Nexus headers), align selfhost cc flags with bootstrap debug/release, and add workspace/symbol search to bux-lsp 0.6. - Parser: zero headers after embedding so auto-drop is a no-op - Request_WantsKeepAlive uses RequestHeader_Get again safely - Selfhost: default -O0 -g; --release -O2 -DNDEBUG; BUX_CFLAGS - LSP: workspace/symbol + smoke; version 0.6.0
This commit is contained in:
+22
-8
@@ -133,19 +133,33 @@ module Http {
|
||||
return "";
|
||||
}
|
||||
|
||||
/// Decide keep-alive from the raw request bytes (avoids fragile header Array walk).
|
||||
/// HTTP/1.1 defaults to keep-alive; Connection: close forces close;
|
||||
/// HTTP/1.0 needs explicit keep-alive.
|
||||
pub func RawRequest_WantsKeepAlive(raw: String) -> bool {
|
||||
if String_Contains(raw, "Connection: close") || String_Contains(raw, "connection: close") ||
|
||||
String_Contains(raw, "CONNECTION: CLOSE") {
|
||||
/// HTTP/1.0 needs explicit keep-alive. Uses parsed headers (safe after
|
||||
/// Parser field-move ownership handoff).
|
||||
pub func Request_WantsKeepAlive(req: *HttpRequest) -> bool {
|
||||
let conn: String = RequestHeader_Get(req, "Connection");
|
||||
if String_EqIgnoreCase(conn, "close") {
|
||||
return false;
|
||||
}
|
||||
if String_EqIgnoreCase(conn, "keep-alive") {
|
||||
return true;
|
||||
}
|
||||
if String_StartsWith(req.version, "HTTP/1.0") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Fallback when only raw bytes are available.
|
||||
pub func RawRequest_WantsKeepAlive(raw: String) -> bool {
|
||||
if String_Contains(raw, "Connection: close") || String_Contains(raw, "connection: close") ||
|
||||
String_Contains(raw, "CONNECTION: CLOSE") {
|
||||
return false;
|
||||
}
|
||||
// HTTP/1.0 without Keep-Alive → close
|
||||
if String_Contains(raw, "HTTP/1.0") {
|
||||
if String_Contains(raw, "Connection: keep-alive") ||
|
||||
String_Contains(raw, "Connection: Keep-Alive") ||
|
||||
String_Contains(raw, "connection: keep-alive") {
|
||||
String_Contains(raw, "Connection: Keep-Alive") ||
|
||||
String_Contains(raw, "connection: keep-alive") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user