Skip to content

Commit 940178c

Browse files
authored
Fix saving and re-opening of server-side documents on VS Code 1.101.0 (#1584)
1 parent dad6746 commit 940178c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/api/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,25 @@ export class AtelierAPI {
515515

516516
return data;
517517
} catch (error) {
518+
if (
519+
error?.message?.includes("Connection: close") &&
520+
path?.includes("/doc/") &&
521+
headers &&
522+
headers["IF-NONE-MATCH"]
523+
) {
524+
// This "Parse Error: Data after `Connection: close`" error is caused by
525+
// stricter behavior in the llhttp library introduced in Node 22/VS Code 1.101.0.
526+
// This only affects servers that use IIS as a web server, and it only occurs
527+
// when a 304 Not Modified response is sent from the server.
528+
// See https://github.com/intersystems-community/vscode-objectscript/issues/1583
529+
if (outputTraffic) {
530+
outputRequest();
531+
outputChannel.appendLine(`+- RESPONSE -----------------------------------------`);
532+
outputChannel.appendLine("304 Not Modified");
533+
outputChannel.appendLine(`+- END ----------------------------------------------`);
534+
}
535+
throw { statusCode: 304, message: "Not Modified" };
536+
}
518537
if (outputTraffic && !error.statusCode) {
519538
// Only output errors here if they were "hard" errors, not HTTP response errors
520539
outputRequest();

0 commit comments

Comments
 (0)