summaryrefslogtreecommitdiff
path: root/libsoup/soup-uri.h
blob: c9c9e787908a8ce4384d23b2e97839a30492041a (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* url-util.h : utility functions to parse URLs */

/* 
 * Copyright 1999-2002 Ximian, Inc.
 */


#ifndef  SOUP_URI_H
#define  SOUP_URI_H 1

#include <libsoup/soup-types.h>

G_BEGIN_DECLS

/**
 * SoupProtocol:
 *
 * #GQuark is used for SoupProtocol so that the protocol of a #SoupUri
 * can be tested quickly.
 **/
typedef GQuark SoupProtocol;

/**
 * SOUP_PROTOCOL_HTTP:
 *
 * This returns the #SoupProtocol value for "http".
 **/
#define SOUP_PROTOCOL_HTTP (g_quark_from_static_string ("http"))

/**
 * SOUP_PROTOCOL_HTTPS:
 *
 * This returns the #SoupProtocol value for "https".
**/
#define SOUP_PROTOCOL_HTTPS (g_quark_from_static_string ("https"))

struct SoupUri {
	SoupProtocol  protocol;

	char         *user;
	char         *passwd;

	char         *host;
	guint         port;

	char         *path;
	char         *query;

	char         *fragment;

	/* Don't use this */
	gboolean      broken_encoding;
};

SoupUri  *soup_uri_new_with_base     (const SoupUri *base,
				      const char    *uri_string);
SoupUri  *soup_uri_new               (const char    *uri_string);

char     *soup_uri_to_string         (const SoupUri *uri, 
				      gboolean       just_path);

SoupUri  *soup_uri_copy              (const SoupUri *uri);
SoupUri  *soup_uri_copy_root         (const SoupUri *uri);

gboolean  soup_uri_equal             (const SoupUri *uri1, 
				      const SoupUri *uri2);

void      soup_uri_free              (SoupUri       *uri);

char     *soup_uri_encode            (const char    *part,
				      const char    *escape_extra);
void      soup_uri_decode            (char          *part);

gboolean  soup_uri_uses_default_port (const SoupUri *uri);

G_END_DECLS

#endif /*SOUP_URI_H*/