1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04: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--) for (i--; i >= 0; i--)
delete_option_do(&info[i].option, 0); 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, VERBOSE_LEVELS,
}; };
int get_https_by_default(void);
const char *get_default_protocol(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -3,6 +3,11 @@
#include <stdio.h> #include <stdio.h>
#include "path.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 main(int argc, char **argv)
{ {
int res = is_path_prefix(argv[1], argv[2]); int res = is_path_prefix(argv[1], argv[2]);

View File

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

View File

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

View File

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