Another URL in DilloHtml.
This commit is contained in:
@ -360,7 +360,7 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
|
|||||||
else {
|
else {
|
||||||
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
|
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
|
||||||
BUG_MSG("<form> requires action attribute.");
|
BUG_MSG("<form> requires action attribute.");
|
||||||
action = a_Url_dup(html->base_url);
|
action = a_Url_dup(html->base_url.get());
|
||||||
}
|
}
|
||||||
content_type = DILLO_HTML_ENC_URLENCODED;
|
content_type = DILLO_HTML_ENC_URLENCODED;
|
||||||
if ((method == DILLO_HTML_METHOD_POST) &&
|
if ((method == DILLO_HTML_METHOD_POST) &&
|
||||||
@ -584,7 +584,7 @@ void Html_tag_open_isindex(DilloHtml *html, const char *tag, int tagsize)
|
|||||||
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "action")))
|
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "action")))
|
||||||
action = a_Html_url_new(html, attrbuf, NULL, 0);
|
action = a_Html_url_new(html, attrbuf, NULL, 0);
|
||||||
else
|
else
|
||||||
action = a_Url_dup(html->base_url);
|
action = a_Url_dup(html->base_url.get());
|
||||||
|
|
||||||
html->formNew(DILLO_HTML_METHOD_GET, action.get(), DILLO_HTML_ENC_URLENCODED,
|
html->formNew(DILLO_HTML_METHOD_GET, action.get(), DILLO_HTML_ENC_URLENCODED,
|
||||||
html->charset.has_value() ? html->charset.value().c_str() : nullptr);
|
html->charset.has_value() ? html->charset.value().c_str() : nullptr);
|
||||||
|
|||||||
26
src/html.cc
26
src/html.cc
@ -191,7 +191,7 @@ std::unique_ptr< DilloUrl > a_Html_url_new(DilloHtml *html,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr< DilloUrl > url = a_Url_new(url_str,
|
std::unique_ptr< DilloUrl > url = a_Url_new(url_str,
|
||||||
(use_base_url) ? base_url : URL_STR_(html->base_url));
|
(use_base_url) ? base_url : URL_STR_(html->base_url.get()));
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
BUG_MSG("URL is not valid '%s'.", url_str);
|
BUG_MSG("URL is not valid '%s'.", url_str);
|
||||||
@ -446,7 +446,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url,
|
|||||||
/* Init main variables */
|
/* Init main variables */
|
||||||
bw = p_bw;
|
bw = p_bw;
|
||||||
page_url = a_Url_dup(url);
|
page_url = a_Url_dup(url);
|
||||||
base_url = a_Url_dup(url).release();
|
base_url = a_Url_dup(url);
|
||||||
dw = NULL;
|
dw = NULL;
|
||||||
|
|
||||||
/* Init event receiver */
|
/* Init event receiver */
|
||||||
@ -473,7 +473,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url,
|
|||||||
DocType = DT_NONE; /* assume Tag Soup 0.0! :-) */
|
DocType = DT_NONE; /* assume Tag Soup 0.0! :-) */
|
||||||
DocTypeVersion = 0.0f;
|
DocTypeVersion = 0.0f;
|
||||||
|
|
||||||
styleEngine = std::make_unique< StyleEngine >(HT2LT (this), page_url.get(), base_url, bw->zoom);
|
styleEngine = std::make_unique< StyleEngine >(HT2LT (this), page_url.get(), base_url.get(), bw->zoom);
|
||||||
|
|
||||||
stack = new misc::SimpleVector <DilloHtmlState> (16);
|
stack = new misc::SimpleVector <DilloHtmlState> (16);
|
||||||
stack->increase();
|
stack->increase();
|
||||||
@ -547,8 +547,6 @@ DilloHtml::~DilloHtml()
|
|||||||
freeParseData();
|
freeParseData();
|
||||||
|
|
||||||
a_Bw_remove_doc(bw, this);
|
a_Bw_remove_doc(bw, this);
|
||||||
|
|
||||||
delete base_url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1747,7 +1745,7 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize)
|
|||||||
static void Html_tag_close_style(DilloHtml *html)
|
static void Html_tag_close_style(DilloHtml *html)
|
||||||
{
|
{
|
||||||
if (prefs.parse_embedded_css && html->loadCssFromStash)
|
if (prefs.parse_embedded_css && html->loadCssFromStash)
|
||||||
html->styleEngine->parse(html, html->base_url, html->Stash->str,
|
html->styleEngine->parse(html, html->base_url.get(), html->Stash->str,
|
||||||
html->Stash->len, CSS_ORIGIN_AUTHOR);
|
html->Stash->len, CSS_ORIGIN_AUTHOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3131,7 +3129,7 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize)
|
|||||||
|
|
||||||
auto new_url = a_Html_url_new(html, mr_url, NULL, 0);
|
auto new_url = a_Html_url_new(html, mr_url, NULL, 0);
|
||||||
|
|
||||||
if (a_Url_cmp(html->base_url, new_url.get()) == 0) {
|
if (a_Url_cmp(html->base_url.get(), new_url.get()) == 0) {
|
||||||
/* redirection loop, or empty url string: ignore */
|
/* redirection loop, or empty url string: ignore */
|
||||||
BUG_MSG("<meta> refresh: %s.",
|
BUG_MSG("<meta> refresh: %s.",
|
||||||
*mr_url ? "redirection loop" : "no target URL");
|
*mr_url ? "redirection loop" : "no target URL");
|
||||||
@ -3298,25 +3296,23 @@ static void Html_tag_open_link(DilloHtml *html, const char *tag, int tagsize)
|
|||||||
static void Html_tag_open_base(DilloHtml *html, const char *tag, int tagsize)
|
static void Html_tag_open_base(DilloHtml *html, const char *tag, int tagsize)
|
||||||
{
|
{
|
||||||
const char *attrbuf;
|
const char *attrbuf;
|
||||||
DilloUrl *BaseUrl;
|
std::unique_ptr< DilloUrl > BaseUrl;
|
||||||
|
|
||||||
if (html->InFlags & IN_HEAD) {
|
if (html->InFlags & IN_HEAD) {
|
||||||
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "href"))) {
|
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "href"))) {
|
||||||
bool_t html5 = html->DocType == DT_HTML &&
|
bool_t html5 = html->DocType == DT_HTML &&
|
||||||
html->DocTypeVersion >= 5.0f;
|
html->DocTypeVersion >= 5.0f;
|
||||||
|
|
||||||
BaseUrl = html5 ? a_Html_url_new(html, attrbuf, NULL, 0).release() :
|
BaseUrl = html5 ? a_Html_url_new(html, attrbuf, NULL, 0) :
|
||||||
a_Html_url_new(html, attrbuf, "", 1).release();
|
a_Html_url_new(html, attrbuf, "", 1);
|
||||||
|
|
||||||
if (html5 || URL_SCHEME_(BaseUrl)) {
|
if (html5 || URL_SCHEME_(BaseUrl.get())) {
|
||||||
/* Pass the URL_SpamSafe flag to the new base url */
|
/* Pass the URL_SpamSafe flag to the new base url */
|
||||||
a_Url_set_flags(
|
a_Url_set_flags(
|
||||||
BaseUrl, URL_FLAGS(html->base_url) & URL_SpamSafe);
|
BaseUrl.get(), URL_FLAGS(html->base_url) & URL_SpamSafe);
|
||||||
delete html->base_url;
|
html->base_url = std::move( BaseUrl );
|
||||||
html->base_url = BaseUrl;
|
|
||||||
} else {
|
} else {
|
||||||
BUG_MSG("<base> URI is relative (it MUST be absolute).");
|
BUG_MSG("<base> URI is relative (it MUST be absolute).");
|
||||||
delete BaseUrl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -168,7 +168,7 @@ public: //BUG: for now everything is public
|
|||||||
|
|
||||||
BrowserWindow *bw;
|
BrowserWindow *bw;
|
||||||
std::unique_ptr< DilloUrl > page_url;
|
std::unique_ptr< DilloUrl > page_url;
|
||||||
DilloUrl *base_url;
|
std::unique_ptr< DilloUrl > base_url;
|
||||||
dw::core::Widget *dw; /* this is duplicated in the stack */
|
dw::core::Widget *dw; /* this is duplicated in the stack */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------*/
|
/* -------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user