emscripten-core / emscripten-core/emscripten

Add argument to emscripten_async_wget (and similar wget functions) to set fetch settings

Open
#22,403 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Currently, emscripten_async_wget and its sibling functions emscripten_async_wget_data, emscripten_async_wget2 and emscripten_async_wget2_data do not have a parameter that dynamically sets fetchSettings. Instead fetch settings are either pulled from a Module['fetchSettings'] global constant or, if that is not provided, a default is used.

In at least one fetchSettings case (credentials), it can be necessary to use a different value for different URLs. If credentials = include, that causes CORS errors fetching from cross domains that don't support cross domain credentials. If credentials = same-origin, then credentials won't be shared with cross domains that do support cross domain credentials.

One workaround is to mutate Module['fetchSettings'] just prior to calling emscriptent_async_wget and then reset it just after to get the same effect. However, this is less ergonomic and obvious than a fetchSettings parameter would be.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.