Merge pull request #129 from wiidev/master

Fix downloads from insecure websites
This commit is contained in:
Fledge68 2019-10-29 15:08:04 -05:00 committed by GitHub
commit 59a9c59a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ int https_write(HTTP_INFO *httpinfo, char *buffer, int len)
if (ret == 0) if (ret == 0)
continue; continue;
else if (ret <= 0) else if (ret <= 0)
return ret; // timeout would return -1 return ret; // Timeout would return -1
slen += ret; slen += ret;
if (slen >= len) if (slen >= len)
@ -40,9 +40,10 @@ int https_write(HTTP_INFO *httpinfo, char *buffer, int len)
int https_read(HTTP_INFO *httpinfo, char *buffer, int len) int https_read(HTTP_INFO *httpinfo, char *buffer, int len)
{ {
if (len > 8192)
len = 8192; // 16KB is the max on a Wii, but 8KB is safe
if (httpinfo->use_https) if (httpinfo->use_https)
return wolfSSL_read(httpinfo->ssl, buffer, len); return wolfSSL_read(httpinfo->ssl, buffer, len);
return net_read(httpinfo->sock, buffer, len); return net_read(httpinfo->sock, buffer, len);
} }