1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[test] compilation fixes

This commit is contained in:
Witold Filipczyk 2022-10-03 19:38:22 +02:00
parent 1509fab35a
commit 9cb4f4544e
6 changed files with 45 additions and 6 deletions

View File

@ -1423,3 +1423,15 @@ unregister_options(union option_info info[], struct option *tree)
for (i--; i >= 0; i--)
delete_option_do(&info[i].option, 0);
}
int
get_https_by_default(void)
{
return get_opt_bool("connection.ssl.https_by_default", NULL);
}
const char *
get_default_protocol(void)
{
return get_opt_str("protocol.default_protocol", NULL);
}

View File

@ -565,6 +565,10 @@ enum verbose_level {
VERBOSE_LEVELS,
};
int get_https_by_default(void);
const char *get_default_protocol(void);
#ifdef __cplusplus
}
#endif

View File

@ -3,6 +3,11 @@
#include <stdio.h>
#include "path.h"
/* fake tty get function, needed for charsets.c */
int get_ctl_handle() {
return -1;
}
int main(int argc, char **argv)
{
int res = is_path_prefix(argv[1], argv[2]);

View File

@ -5,7 +5,7 @@ TEST_PROGS = \
uri-test$(EXEEXT)
TESTDEPS = \
$(top_builddir)/src/protocol/protocol.o \
$(top_builddir)/src/protocol/protocol.obj \
$(top_builddir)/src/protocol/uri.o \
stub.o

View File

@ -7,11 +7,24 @@
#include "elinks.h"
int
get_https_by_default(void)
{
return 0;
}
const char *
get_default_protocol(void)
{
return "file://";
}
#include "protocol/uri.h"
#include "util/string.h"
/* fake tty get function, needed for charsets.c */
int get_ctl_handle() {
int get_ctl_handle()
{
return -1;
}

View File

@ -1254,6 +1254,7 @@ parse_uri:
}
case URI_ERRNO_INVALID_PROTOCOL:
{
const char *default_protocol;
/* No protocol name */
protocol_T protocol = find_uri_protocol(newurl);
struct string str;
@ -1268,7 +1269,7 @@ parse_uri:
case PROTOCOL_HTTP:
#ifdef CONFIG_SSL
if (get_opt_bool("connection.ssl.https_by_default", NULL))
if (get_https_by_default())
add_to_string(&str, "https://");
else
#endif
@ -1277,9 +1278,13 @@ parse_uri:
break;
case PROTOCOL_UNKNOWN:
add_to_string(&str, get_opt_str("protocol.default_protocol", NULL));
add_to_string(&str, newurl);
break;
default_protocol = get_default_protocol();
if (strcmp("file://", default_protocol)) {
add_to_string(&str, default_protocol);
add_to_string(&str, newurl);
break;
}
case PROTOCOL_FILE:
default:
add_to_string(&str, "file://");