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
80
81
82
83
84
85
86
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2000-2003, Ximian, Inc.
*/
#ifndef __SOUP_MISC_H__
#define __SOUP_MISC_H__ 1
#include "soup-types.h"
#include "soup-message.h"
#include "soup-message-headers.h"
G_BEGIN_DECLS
/* Non-default-GMainContext operations */
void soup_add_completion (GMainContext *async_context,
GSourceFunc function,
gpointer data);
GSource *soup_add_timeout (GMainContext *async_context,
guint interval,
GSourceFunc function,
gpointer data);
/* Misc utils */
guint soup_str_case_hash (gconstpointer key);
gboolean soup_str_case_equal (gconstpointer v1,
gconstpointer v2);
/* character classes */
extern const char soup_char_attributes[];
#define SOUP_CHAR_URI_PERCENT_ENCODED 0x01
#define SOUP_CHAR_URI_GEN_DELIMS 0x02
#define SOUP_CHAR_URI_SUB_DELIMS 0x04
#define SOUP_CHAR_HTTP_SEPARATOR 0x08
#define SOUP_CHAR_HTTP_CTL 0x10
#define soup_char_is_uri_percent_encoded(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_PERCENT_ENCODED)
#define soup_char_is_uri_gen_delims(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_GEN_DELIMS)
#define soup_char_is_uri_sub_delims(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_SUB_DELIMS)
#define soup_char_is_uri_unreserved(ch) (!(soup_char_attributes[(guchar)ch] & (SOUP_CHAR_URI_PERCENT_ENCODED | SOUP_CHAR_URI_GEN_DELIMS | SOUP_CHAR_URI_SUB_DELIMS)))
#define soup_char_is_token(ch) (!(soup_char_attributes[(guchar)ch] & (SOUP_CHAR_HTTP_SEPARATOR | SOUP_CHAR_HTTP_CTL)))
char *soup_uri_decoded_copy (const char *str, int length, int *decoded_length);
char *soup_uri_to_string_internal (SoupURI *uri, gboolean just_path_and_query,
gboolean include_password, gboolean force_port);
gboolean soup_uri_is_http (SoupURI *uri, char **aliases);
gboolean soup_uri_is_https (SoupURI *uri, char **aliases);
/* At some point it might be possible to mark additional methods
* safe or idempotent...
*/
#define SOUP_METHOD_IS_SAFE(method) (method == SOUP_METHOD_GET || \
method == SOUP_METHOD_HEAD || \
method == SOUP_METHOD_OPTIONS || \
method == SOUP_METHOD_PROPFIND || \
method == SOUP_METHOD_TRACE)
#define SOUP_METHOD_IS_IDEMPOTENT(method) (method == SOUP_METHOD_GET || \
method == SOUP_METHOD_HEAD || \
method == SOUP_METHOD_OPTIONS || \
method == SOUP_METHOD_PROPFIND || \
method == SOUP_METHOD_TRACE || \
method == SOUP_METHOD_PUT || \
method == SOUP_METHOD_DELETE)
GSource *soup_add_completion_reffed (GMainContext *async_context,
GSourceFunc function,
gpointer data,
GDestroyNotify dnotify);
guint soup_message_headers_get_ranges_internal (SoupMessageHeaders *hdrs,
goffset total_length,
gboolean check_satisfiable,
SoupRange **ranges,
int *length);
gboolean soup_host_matches_host (const gchar *host,
const gchar *compare_with);
gchar *soup_get_accept_languages_from_system (void);
G_END_DECLS
#endif /* __SOUP_MISC_H__ */
|