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