summaryrefslogtreecommitdiff
path: root/src/gmrequest.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-07-25 09:12:27 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-07-25 09:12:27 +0300
commit89eca3384af875dc59f2563c33f8e35a923fbfe1 (patch)
tree40bdcc105aa8ff3b343fc3f93d44376a7f41acad /src/gmrequest.c
parenta81b43d33c7b37996cd04c527917c3651c5cdc65 (diff)
Encode spaces in URLs
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r--src/gmrequest.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c
index ce53abee..6f2c2bc5 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -73,6 +73,7 @@ void deinit_GmRequest(iGmRequest *d) {
73 73
74void setUrl_GmRequest(iGmRequest *d, const iString *url) { 74void setUrl_GmRequest(iGmRequest *d, const iString *url) {
75 set_String(&d->url, url); 75 set_String(&d->url, url);
76 urlEncodeSpaces_String(&d->url);
76} 77}
77 78
78static uint32_t timedOutWhileReceivingBody_GmRequest_(uint32_t interval, void *obj) { 79static uint32_t timedOutWhileReceivingBody_GmRequest_(uint32_t interval, void *obj) {
@@ -174,7 +175,8 @@ void submit_GmRequest(iGmRequest *d) {
174 iUrl url; 175 iUrl url;
175 init_Url(&url, &d->url); 176 init_Url(&url, &d->url);
176 if (!cmpCStrSc_Rangecc(&url.protocol, "file", &iCaseInsensitive)) { 177 if (!cmpCStrSc_Rangecc(&url.protocol, "file", &iCaseInsensitive)) {
177 iFile *f = new_File(collect_String(newRange_String(url.path))); 178 iString *path = collect_String(urlDecode_String(collect_String(newRange_String(url.path))));
179 iFile * f = new_File(path);
178 if (open_File(f, readOnly_FileMode)) { 180 if (open_File(f, readOnly_FileMode)) {
179 /* TODO: Check supported file types: images, audio */ 181 /* TODO: Check supported file types: images, audio */
180 d->code = success_GmStatusCode; 182 d->code = success_GmStatusCode;