-
-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle 'path' option in http.request for html5 implementation. #8906
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ namespace dmGameSystem | |
{ | ||
dmMessage::URL m_Requester; | ||
void* m_RequestData; | ||
const char* m_Path; | ||
int m_Callback; | ||
}; | ||
|
||
|
@@ -98,6 +99,7 @@ namespace dmGameSystem | |
resp.m_HeadersLength = headers_length; | ||
resp.m_Response = (uint64_t) response; | ||
resp.m_ResponseLength = response_length; | ||
resp.m_Path = ctx->m_Path; | ||
|
||
resp.m_Headers = (uint64_t) malloc(headers_length); | ||
memcpy((void*) resp.m_Headers, headers, headers_length); | ||
|
@@ -143,6 +145,7 @@ namespace dmGameSystem | |
int top = lua_gettop(L); | ||
|
||
int callback = 0; | ||
const char* path = 0; | ||
dmMessage::URL sender; | ||
if (dmScript::GetURL(L, &sender)) { | ||
RequestParams request_params; | ||
|
@@ -205,6 +208,10 @@ namespace dmGameSystem | |
{ | ||
request_params.m_ReportProgress = lua_toboolean(L, -1); | ||
} | ||
else if (strcmp(attr, "path") == 0) | ||
{ | ||
path = luaL_checkstring(L, -1); | ||
} | ||
lua_pop(L, 1); | ||
} | ||
lua_pop(L, 1); | ||
|
@@ -214,6 +221,7 @@ namespace dmGameSystem | |
ctx->m_Callback = callback; | ||
ctx->m_Requester = sender; | ||
ctx->m_RequestData = request_params.m_SendData; | ||
ctx->m_Path = path; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got a bunch of issues using
I take a look PR again, and see that we don't copy string to manage it ourself, so it's Lua that manages it. I think we should memcopy this string as ell as we do for headers and free it when we don't need it anymore |
||
|
||
request_params.m_Args = ctx; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if IndexedDB isn't supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://emscripten.org/docs/api_reference/Filesystem-API.html#memfs
As I understand if no persistent storage is presented - in-memory FS will be used.