Skip to content

Conversation

@carlopi
Copy link
Collaborator

@carlopi carlopi commented Jun 27, 2025

No description provided.

@carlopi carlopi force-pushed the try_catch_getresponseheaders branch from 3378a82 to 51b5481 Compare June 27, 2025 09:20
@carlopi carlopi merged commit 54110f0 into duckdb:main Jun 27, 2025
15 checks passed
Comment on lines -291 to 293
const contentRange = xhr.getResponseHeader('Content-Range')?.split('/')[1];
const contentLength2 = xhr.getResponseHeader('Content-Length');
let actualContentLength = null;
try { actualContentLength = xhr.getResponseHeader('Content-Length'); } catch (e: any) {console.warn(`Failed to get Content-Length on request`);}
const contentRange = actualContentLength?.split('/')[1];
const contentLength2 = actualContentLength;

Copy link

@jbruggem jbruggem Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlopi I stumbled on this changed while trying to understand why duckdb-wasm seemed unhappy with the behaviour of my server.

This change means that the code now looks for the actually content length in the Content-Length header (by splitting on /) instead of the previous behaviour of looking for it in the Content-Range.

I believe the pre-diff behaviour is correct, as Content-Length shouldn't contain a / and shouldn't send the full content length.

Should I open a PR to suggest a fix ?

See:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! thanks for digging in, this looks like it's a problem, not great, a PR with a suggested fix would be great!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for the quick reply ! Here's a PR: #2123

I tried to stay as close to the original code as I could

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants