In elinks-0.12/src/session/session.c, doc_loading_callback does:
if (!is_in_state(download->state, S_OK)) {
print_error_dialog(ses, download->state,
ses->doc_view->document->uri,
download->pri);
}Here, ses->doc_view->document->uri is the URI of the frameset, which is the wrong thing to display. The URI of the frame seems to be in download->conn->uri or download->conn->proxied_uri. (download->cached was NULL in my test, so download->cached->uri was unusable. Also, ses->loading_uri was NULL.) When ELinks is beginning to download a frame, request_frame calls request_additional_file, which constructs struct file_to_load, which has struct download as a member. Although request_additional_file returns struct file_to_load *, the return value is never used. Instead, process_file_requests finds these structures in the session::more_files list and calls load_uri on each. load_uri can call download->callback without ever setting a non-null download->conn: for example, if the URI is malformed, or if init_connection fails. This means doc_loading_callback cannot reliably get the frame URI From download->conn if the download has failed. Do not imitate the #ifdef CONFIG_GLOBHIST section of doc_loading_callback because that gets run only if the download has succeeded. I suspect we should either add the URI to struct download, or add it as a third parameter to doc_loading_callback and update all callers. Or maybe add dynamically allocated error objects so that the URI can be carried as part of the error...? That would also be a way to propagate the GnuTLS certificate status bits together with S_SSL_ERROR.
pgpuCUF9tXwYq.pgp
Description: PGP signature

