[libsoup/websocket: 8/10] uri: add support for WebSocket schemes
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/websocket: 8/10] uri: add support for WebSocket schemes
- Date: Sun, 14 Dec 2014 14:30:10 +0000 (UTC)
commit a416775fff2255b89119366daf9cf53732677310
Author: Lionel Landwerlin <llandwerlin gmail com>
Date: Mon Jan 20 13:41:02 2014 +0000
uri: add support for WebSocket schemes
libsoup/libsoup-2.4.sym | 2 ++
libsoup/soup-uri.c | 9 +++++++--
libsoup/soup-uri.h | 3 +++
3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/libsoup-2.4.sym b/libsoup/libsoup-2.4.sym
index 642cd0c..2ee33fb 100644
--- a/libsoup/libsoup-2.4.sym
+++ b/libsoup/libsoup-2.4.sym
@@ -19,6 +19,8 @@ _SOUP_URI_SCHEME_FTP
_SOUP_URI_SCHEME_HTTP
_SOUP_URI_SCHEME_HTTPS
_SOUP_URI_SCHEME_RESOURCE
+_SOUP_URI_SCHEME_WS
+_SOUP_URI_SCHEME_WSS
soup_add_completion
soup_add_idle
soup_add_io_watch
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index fcd7d53..e3e0dbc 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -160,6 +160,7 @@ static void append_uri_encoded (GString *str, const char *in, const char *extra_
static char *uri_normalized_copy (const char *str, int length, const char *unescape_extra);
gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS;
+gpointer _SOUP_URI_SCHEME_WS, _SOUP_URI_SCHEME_WSS;
gpointer _SOUP_URI_SCHEME_FTP;
gpointer _SOUP_URI_SCHEME_FILE, _SOUP_URI_SCHEME_DATA, _SOUP_URI_SCHEME_RESOURCE;
@@ -172,6 +173,10 @@ soup_uri_parse_scheme (const char *scheme, int len)
return SOUP_URI_SCHEME_HTTPS;
} else if (len == 8 && !g_ascii_strncasecmp (scheme, "resource", len)) {
return SOUP_URI_SCHEME_RESOURCE;
+ } else if (len == 2 && !g_ascii_strncasecmp (scheme, "ws", len)) {
+ return SOUP_URI_SCHEME_WS;
+ } else if (len == 3 && !g_ascii_strncasecmp (scheme, "wss", len)) {
+ return SOUP_URI_SCHEME_WSS;
} else {
char *lower_scheme;
@@ -186,9 +191,9 @@ soup_uri_parse_scheme (const char *scheme, int len)
static inline guint
soup_scheme_default_port (const char *scheme)
{
- if (scheme == SOUP_URI_SCHEME_HTTP)
+ if (scheme == SOUP_URI_SCHEME_HTTP || scheme == SOUP_URI_SCHEME_WS)
return 80;
- else if (scheme == SOUP_URI_SCHEME_HTTPS)
+ else if (scheme == SOUP_URI_SCHEME_HTTPS || scheme == SOUP_URI_SCHEME_WSS)
return 443;
else if (scheme == SOUP_URI_SCHEME_FTP)
return 21;
diff --git a/libsoup/soup-uri.h b/libsoup/soup-uri.h
index fca97f7..35e670c 100644
--- a/libsoup/soup-uri.h
+++ b/libsoup/soup-uri.h
@@ -37,9 +37,12 @@ GType soup_uri_get_type (void);
#define SOUP_URI_SCHEME_FILE _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_FILE, "file")
#define SOUP_URI_SCHEME_DATA _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_DATA, "data")
#define SOUP_URI_SCHEME_RESOURCE _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_RESOURCE, "resource")
+#define SOUP_URI_SCHEME_WS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WS, "ws")
+#define SOUP_URI_SCHEME_WSS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WSS, "wss")
extern gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS;
extern gpointer _SOUP_URI_SCHEME_FTP;
extern gpointer _SOUP_URI_SCHEME_FILE, _SOUP_URI_SCHEME_DATA, _SOUP_URI_SCHEME_RESOURCE;
+extern gpointer _SOUP_URI_SCHEME_WS, _SOUP_URI_SCHEME_WSS;
SoupURI *soup_uri_new_with_base (SoupURI *base,
const char *uri_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]