diff options
| author | Dan Winship <danw@gnome.org> | 2013-08-25 10:51:22 -0400 |
|---|---|---|
| committer | Dan Winship <danw@gnome.org> | 2013-08-26 11:00:42 -0400 |
| commit | 4a8b1c0544b168b25cbd3b016b7aedee263515ba (patch) | |
| tree | 823f0e9fbc26d311aa3fb6e16f80684407ecb86f /libsoup/soup-uri.c | |
| parent | 3935e102d8195ec12349e688b87e200df4f33649 (diff) | |
| download | libsoup-4a8b1c0544b168b25cbd3b016b7aedee263515ba.tar.gz | |
SoupServer: add :http-aliases and :https-aliases properties
Add :http-aliases and :https-aliases properties to SoupServer, to
allow it to handle requests like:
GET daap://host:port/path HTTP/1.1
https://bugzilla.gnome.org/show_bug.cgi?id=703694
Diffstat (limited to 'libsoup/soup-uri.c')
| -rw-r--r-- | libsoup/soup-uri.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c index 6e3d220b..808d2ccc 100644 --- a/libsoup/soup-uri.c +++ b/libsoup/soup-uri.c @@ -1291,4 +1291,47 @@ soup_uri_host_equal (gconstpointer v1, gconstpointer v2) return g_ascii_strcasecmp (one->host, two->host) == 0; } +gboolean +soup_uri_is_http (SoupURI *uri, char **aliases) +{ + int i; + + if (uri->scheme == SOUP_URI_SCHEME_HTTP) + return TRUE; + else if (uri->scheme == SOUP_URI_SCHEME_HTTPS) + return FALSE; + else if (!aliases) + return FALSE; + + for (i = 0; aliases[i]; i++) { + if (uri->scheme == aliases[i]) + return TRUE; + } + + if (!aliases[1] && !strcmp (aliases[0], "*")) + return TRUE; + else + return FALSE; +} + +gboolean +soup_uri_is_https (SoupURI *uri, char **aliases) +{ + int i; + + if (uri->scheme == SOUP_URI_SCHEME_HTTPS) + return TRUE; + else if (uri->scheme == SOUP_URI_SCHEME_HTTP) + return FALSE; + else if (!aliases) + return FALSE; + + for (i = 0; aliases[i]; i++) { + if (uri->scheme == aliases[i]) + return TRUE; + } + + return FALSE; +} + G_DEFINE_BOXED_TYPE (SoupURI, soup_uri, soup_uri_copy, soup_uri_free) |
