Commit | Line | Data |
---|---|---|
36bde473 | 1 | /* |
2 | * This file is part of DisOrder | |
3 | * Copyright (C) 2007 Richard Kettlewell | |
4 | * | |
e7eb3a27 | 5 | * This program is free software: you can redistribute it and/or modify |
36bde473 | 6 | * it under the terms of the GNU General Public License as published by |
e7eb3a27 | 7 | * the Free Software Foundation, either version 3 of the License, or |
36bde473 | 8 | * (at your option) any later version. |
e7eb3a27 RK |
9 | * |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
36bde473 | 15 | * You should have received a copy of the GNU General Public License |
e7eb3a27 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
36bde473 | 17 | */ |
18 | /** @file lib/url.h | |
19 | * @brief URL support functions | |
20 | */ | |
21 | ||
22 | #ifndef URL_H | |
23 | #define URL_H | |
24 | ||
25 | /** @brief A parsed HTTP URL */ | |
26 | struct url { | |
27 | /** @brief URL scheme | |
28 | * | |
29 | * Typically "http" or "https". Might be NULL for a relative URL. | |
30 | */ | |
31 | char *scheme; | |
32 | ||
33 | /** @brief Username | |
34 | * | |
35 | * Might well be NULL. NB not supported currently. | |
36 | */ | |
37 | char *user; | |
38 | ||
39 | /** @brief Password | |
40 | * | |
41 | * Migth well be NULL. NB not supported currently. | |
42 | */ | |
43 | char *password; | |
44 | ||
45 | /** @brief Hostname | |
46 | * | |
47 | * Might be NULL for a relative URL. | |
48 | */ | |
49 | char *host; | |
50 | ||
51 | /** @brief Port number or -1 if none specified */ | |
52 | long port; | |
53 | ||
54 | /** @brief Path | |
55 | * | |
56 | * May be the empty string. Never NULL. Will be decoded from the | |
57 | * original URL. | |
58 | */ | |
59 | char *path; | |
60 | ||
61 | /** @brief Query | |
62 | * | |
63 | * NULL if there was no query part. Will NOT be decoded from the | |
64 | * original URL. | |
65 | */ | |
66 | char *query; | |
67 | }; | |
68 | ||
cc5b0a8e | 69 | char *infer_url(int include_path_info); |
36bde473 | 70 | int parse_url(const char *url, struct url *parsed); |
71 | ||
72 | #endif /* URL_H */ | |
73 | ||
74 | /* | |
75 | Local Variables: | |
76 | c-basic-offset:2 | |
77 | comment-column:40 | |
78 | fill-column:79 | |
79 | indent-tabs-mode:nil | |
80 | End: | |
81 | */ |