diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-24 23:04:28 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-24 23:04:28 +0200 |
commit | cf93928fe9cb4ce1600f2f472191ce88e94ee0d7 (patch) | |
tree | 2d1e7c61ad1c1476986d6a13332c69d2b84c91f9 /src | |
parent | 738a267b8c22172180e549b5a9a14ed32f6bd16d (diff) |
Fixed percent-encoding the query string
Good old mutable vs. non-mutable argument confusion. The encoded return value was ignored (and leaked).
Diffstat (limited to 'src')
-rw-r--r-- | src/gmrequest.c | 4 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c index 3eb57cec..5b005fbb 100644 --- a/src/gmrequest.c +++ b/src/gmrequest.c | |||
@@ -515,7 +515,9 @@ void submit_GmRequest(iGmRequest *d) { | |||
515 | set_Atomic(&d->allowUpdate, iTrue); | 515 | set_Atomic(&d->allowUpdate, iTrue); |
516 | iGmResponse *resp = d->resp; | 516 | iGmResponse *resp = d->resp; |
517 | clear_GmResponse(resp); | 517 | clear_GmResponse(resp); |
518 | // printf("[GmRequest] URL: %s\n", cstr_String(&d->url)); | 518 | #if !defined (NDEBUG) |
519 | printf("[GmRequest] URL: %s\n", cstr_String(&d->url)); | ||
520 | #endif | ||
519 | iUrl url; | 521 | iUrl url; |
520 | init_Url(&url, &d->url); | 522 | init_Url(&url, &d->url); |
521 | /* Check for special schemes. */ | 523 | /* Check for special schemes. */ |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 1830239a..bc9dbc8d 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1622,8 +1622,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1622 | return iTrue; | 1622 | return iTrue; |
1623 | } | 1623 | } |
1624 | else if (equal_Command(cmd, "document.input.submit") && document_App() == d) { | 1624 | else if (equal_Command(cmd, "document.input.submit") && document_App() == d) { |
1625 | iString *value = collect_String(suffix_Command(cmd, "value")); | 1625 | iString *value = suffix_Command(cmd, "value"); |
1626 | urlEncode_String(value); | 1626 | set_String(value, collect_String(urlEncode_String(value))); |
1627 | iString *url = collect_String(copy_String(d->mod.url)); | 1627 | iString *url = collect_String(copy_String(d->mod.url)); |
1628 | const size_t qPos = indexOfCStr_String(url, "?"); | 1628 | const size_t qPos = indexOfCStr_String(url, "?"); |
1629 | if (qPos != iInvalidPos) { | 1629 | if (qPos != iInvalidPos) { |
@@ -1632,6 +1632,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1632 | appendCStr_String(url, "?"); | 1632 | appendCStr_String(url, "?"); |
1633 | append_String(url, value); | 1633 | append_String(url, value); |
1634 | postCommandf_App("open url:%s", cstr_String(url)); | 1634 | postCommandf_App("open url:%s", cstr_String(url)); |
1635 | delete_String(value); | ||
1635 | return iTrue; | 1636 | return iTrue; |
1636 | } | 1637 | } |
1637 | else if (equal_Command(cmd, "valueinput.cancelled") && | 1638 | else if (equal_Command(cmd, "valueinput.cancelled") && |