mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Fix 'Download size' with dropbox texture packs always showing 'Determining..' forever
Fixed on native client to show actual length again by querying X-Dropbox-Content-Length header instead, no such luck for webclient though unfortunately
This commit is contained in:
parent
2a14d1389e
commit
c4fe212b8b
@ -80,6 +80,10 @@ static void Http_ParseHeader(struct HttpRequest* req, const cc_string* line) {
|
||||
String_CopyToRawArray(req->etag, &value);
|
||||
} else if (String_CaselessEqualsConst(&name, "Content-Length")) {
|
||||
Convert_ParseInt(&value, &req->contentLength);
|
||||
} else if (String_CaselessEqualsConst(&name, "X-Dropbox-Content-Length")) {
|
||||
/* dropbox stopped returning Content-Length header since switching to chunked transfer */
|
||||
/* https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-media-can-t-be-access-by-azure-blob/td-p/575458 */
|
||||
Convert_ParseInt(&value, &req->contentLength);
|
||||
} else if (String_CaselessEqualsConst(&name, "Last-Modified")) {
|
||||
String_CopyToRawArray(req->lastModified, &value);
|
||||
} else if (req->cookies && String_CaselessEqualsConst(&name, "Set-Cookie")) {
|
||||
|
@ -3539,7 +3539,7 @@ void UrlWarningOverlay_Show(const cc_string* url) {
|
||||
*#########################################################################################################################*/
|
||||
static struct TexPackOverlay {
|
||||
Screen_Body
|
||||
cc_bool deny, alwaysDeny;
|
||||
cc_bool deny, alwaysDeny, gotContent;
|
||||
cc_uint32 contentLength;
|
||||
cc_string url;
|
||||
int reqID;
|
||||
@ -3613,6 +3613,8 @@ static void TexPackOverlay_UpdateLine3(struct TexPackOverlay* s) {
|
||||
contentLengthMB = s->contentLength / (1024.0f * 1024.0f);
|
||||
String_Format1(&contents, "Download size: %f3 MB", &contentLengthMB);
|
||||
TextWidget_Set(&s->lbls[3], &contents, &s->textFont);
|
||||
} else if (s->gotContent) {
|
||||
TextWidget_SetConst(&s->lbls[3], "Download size: Unknown", &s->textFont);
|
||||
} else {
|
||||
TextWidget_SetConst(&s->lbls[3], "Download size: Determining...", &s->textFont);
|
||||
}
|
||||
@ -3624,6 +3626,7 @@ static void TexPackOverlay_Update(void* screen, double delta) {
|
||||
if (!Http_GetResult(s->reqID, &item)) return;
|
||||
|
||||
s->dirty = true;
|
||||
s->gotContent = true;
|
||||
s->contentLength = item.contentLength;
|
||||
TexPackOverlay_UpdateLine3(s);
|
||||
}
|
||||
@ -3680,6 +3683,7 @@ static void TexPackOverlay_Init(void* screen) {
|
||||
s->maxVertices = TEXPACK_MAX_VERTICES;
|
||||
|
||||
s->contentLength = 0;
|
||||
s->gotContent = false;
|
||||
s->deny = false;
|
||||
Overlay_InitLabels(s->lbls);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user