Add secure libcurl transfer backend
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
add_executable(url_parse_test url_parse_test.c)
|
||||
target_link_libraries(url_parse_test PRIVATE prozilla)
|
||||
add_test(NAME url_parse COMMAND url_parse_test)
|
||||
@@ -0,0 +1,28 @@
|
||||
#include <prozilla.h>
|
||||
#include <url.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static int check(const char *text, uerr_t protocol, unsigned short port)
|
||||
{
|
||||
urlinfo url;
|
||||
uerr_t result = proz_parse_url(text, &url, 0);
|
||||
|
||||
if (result != URLOK || url.proto != protocol || url.port != port)
|
||||
{
|
||||
fprintf(stderr, "failed to parse %s (result=%d protocol=%d port=%u)\n",
|
||||
text, result, url.proto, url.port);
|
||||
return 1;
|
||||
}
|
||||
proz_free_url(&url, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return check("http://example.invalid/file", URLHTTP, 80)
|
||||
|| check("https://example.invalid/file", URLHTTPS, 443)
|
||||
|| check("ftp://example.invalid/file", URLFTP, 21)
|
||||
|| check("ftps://example.invalid/file", URLFTPS, 990)
|
||||
|| check("sftp://example.invalid/file", URLSFTP, 22);
|
||||
}
|
||||
Reference in New Issue
Block a user