-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
50 lines (39 loc) · 1.22 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// Copyright (c) 2023 Brian Sullender
// All rights reserved.
//
// This source code is licensed under the terms provided in the README file.
//
// https://github.com/b-sullender/url-parser
//
#include "url-parser.h"
int main()
{
URL_PARTS* url_parts = (URL_PARTS*)malloc(sizeof(URL_PARTS));
if (url_parts == NULL) {
perror("Memory allocation error");
exit(EXIT_FAILURE);
}
// ----------------- //
// Valid URL testing //
// ----------------- //
ParseURL("http://sullewarehouse.com/login", url_parts);
PrintURL(url_parts);
printf("%s", "\n");
ParseURL("https://sullewarehouse.com:1000/login", url_parts);
PrintURL(url_parts);
printf("%s", "\n");
ParseURL("https://sullewarehouse.com:1000/api/get?username=myuser", url_parts);
PrintURL(url_parts);
printf("%s", "\n");
ParseURL("sullewarehouse.com/register", url_parts);
PrintURL(url_parts);
printf("%s", "\n");
ParseURL("http://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]/newpage", url_parts);
PrintURL(url_parts);
printf("%s", "\n");
ParseURL("https://[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:2678/blog", url_parts);
PrintURL(url_parts);
printf("%s", "\n");
return 0;
}