URI header now returns pointers with ownership.

I've put `.release()` at most of the callsites, but this
gives me something to search for when taking the next
steps.
This commit is contained in:
2025-04-13 15:05:21 -04:00
parent c18a12d223
commit 61c879c218
23 changed files with 151 additions and 156 deletions

View File

@ -377,7 +377,7 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
else {
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
BUG_MSG("<form> requires action attribute.");
action = a_Url_dup(html->base_url);
action = a_Url_dup(*html->base_url).release();
}
content_type = DILLO_HTML_ENC_URLENCODED;
if ((method == DILLO_HTML_METHOD_POST) &&
@ -609,7 +609,7 @@ void Html_tag_open_isindex(DilloHtml *html, const char *tag, int tagsize)
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "action")))
action = a_Html_url_new(html, attrbuf, NULL, 0);
else
action = a_Url_dup(html->base_url);
action = a_Url_dup(*html->base_url).release();
html->formNew(DILLO_HTML_METHOD_GET, action, DILLO_HTML_ENC_URLENCODED,
html->charset.has_value() ? html->charset.value().c_str() : nullptr);
@ -1005,7 +1005,7 @@ DilloHtmlForm::DilloHtmlForm (DilloHtml *html2,
{
html = html2;
method = method2;
action = a_Url_dup(action2);
action = a_Url_dup(*action2).release();
content_type = content_type2;
submit_charset = dStrdup(charset);
num_entry_fields = 0;
@ -1104,12 +1104,12 @@ DilloUrl *DilloHtmlForm::buildQueryUrl(DilloHtmlInput *active_input)
char *action_str = dStrdup(URL_STR(action));
if (method == DILLO_HTML_METHOD_POST) {
new_url = a_Url_new(action_str, NULL);
new_url = a_Url_new(action_str, NULL).release();
/* new_url keeps the dStr and sets DataStr to NULL */
a_Url_set_data(new_url, DataStr);
a_Url_set_flags(new_url, URL_FLAGS(new_url) | URL_Post);
a_Url_set_data(*new_url, DataStr);
a_Url_set_flags(*new_url, URL_FLAGS(new_url) | URL_Post);
if (content_type == DILLO_HTML_ENC_MULTIPART)
a_Url_set_flags(new_url, URL_FLAGS(new_url) | URL_MultipartEnc);
a_Url_set_flags(*new_url, URL_FLAGS(new_url) | URL_MultipartEnc);
} else {
/* remove <fragment> and <query> sections if present */
char *url_str, *p;
@ -1119,8 +1119,8 @@ DilloUrl *DilloHtmlForm::buildQueryUrl(DilloHtmlInput *active_input)
*p = 0;
url_str = dStrconcat(action_str, "?", DataStr.c_str(), NULL);
new_url = a_Url_new(url_str, NULL);
a_Url_set_flags(new_url, URL_FLAGS(new_url) | URL_Get);
new_url = a_Url_new(url_str, NULL).release();
a_Url_set_flags(*new_url, URL_FLAGS(new_url) | URL_Get);
dFree(url_str);
}
dFree(action_str);