Coverage Report

Created: 2026-08-31 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libsoup/libsoup/soup-misc.h
Line
Count
Source
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2
/*
3
 * Copyright (C) 2000-2003, Ximian, Inc.
4
 */
5
6
#ifndef __SOUP_MISC_H__
7
#define __SOUP_MISC_H__ 1
8
9
#include "soup-types.h"
10
#include "soup-message.h"
11
#include "soup-message-headers.h"
12
13
G_BEGIN_DECLS
14
15
/* Non-default-GMainContext operations */
16
void               soup_add_completion       (GMainContext *async_context,
17
                GSourceFunc   function,
18
                gpointer      data);
19
GSource           *soup_add_completion_reffed (GMainContext   *async_context,
20
                                               GSourceFunc     function,
21
                                               gpointer        data,
22
                                               GDestroyNotify  dnotify);
23
GSource           *soup_add_timeout          (GMainContext *async_context,
24
                guint         interval,
25
                GSourceFunc   function,
26
                gpointer      data);
27
GMainContext      *soup_thread_default_context (void);
28
29
/* Misc utils */
30
31
guint              soup_str_case_hash        (gconstpointer key);
32
gboolean           soup_str_case_equal       (gconstpointer v1,
33
                gconstpointer v2);
34
35
/* character classes */
36
37
extern const char soup_char_attributes[];
38
#define SOUP_CHAR_URI_PERCENT_ENCODED 0x01
39
#define SOUP_CHAR_URI_GEN_DELIMS      0x02
40
#define SOUP_CHAR_URI_SUB_DELIMS      0x04
41
0
#define SOUP_CHAR_HTTP_SEPARATOR      0x08
42
0
#define SOUP_CHAR_HTTP_CTL            0x10
43
44
#define soup_char_is_uri_percent_encoded(ch) (soup_char_attributes[(guchar)(ch)] & SOUP_CHAR_URI_PERCENT_ENCODED)
45
#define soup_char_is_uri_gen_delims(ch)      (soup_char_attributes[(guchar)(ch)] & SOUP_CHAR_URI_GEN_DELIMS)
46
#define soup_char_is_uri_sub_delims(ch)      (soup_char_attributes[(guchar)(ch)] & SOUP_CHAR_URI_SUB_DELIMS)
47
#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)))
48
0
#define soup_char_is_token(ch)               (!(soup_char_attributes[(guchar)(ch)] & (SOUP_CHAR_HTTP_SEPARATOR | SOUP_CHAR_HTTP_CTL)))
49
50
/* At some point it might be possible to mark additional methods
51
 * safe or idempotent...
52
 */
53
0
#define SOUP_METHOD_IS_SAFE(method) ((method) == SOUP_METHOD_GET || \
54
0
             (method) == SOUP_METHOD_HEAD || \
55
0
             (method) == SOUP_METHOD_OPTIONS || \
56
0
             (method) == SOUP_METHOD_PROPFIND || \
57
0
             (method) == SOUP_METHOD_TRACE)
58
59
0
#define SOUP_METHOD_IS_IDEMPOTENT(method) ((method) == SOUP_METHOD_GET || \
60
0
             (method) == SOUP_METHOD_HEAD || \
61
0
             (method) == SOUP_METHOD_OPTIONS || \
62
0
             (method) == SOUP_METHOD_PROPFIND || \
63
0
             (method) == SOUP_METHOD_TRACE || \
64
0
             (method) == SOUP_METHOD_PUT || \
65
0
             (method) == SOUP_METHOD_DELETE)
66
67
guint soup_message_headers_get_ranges_internal (SoupMessageHeaders  *hdrs,
68
            goffset              total_length,
69
            gboolean             check_satisfiable,
70
            SoupRange          **ranges,
71
            int                 *length);
72
73
gboolean           soup_host_matches_host    (const gchar *host,
74
                const gchar *compare_with);
75
76
gchar *soup_get_accept_languages_from_system (void);
77
78
const char *soup_http_version_to_string (SoupHTTPVersion version);
79
80
G_END_DECLS
81
82
#endif /* __SOUP_MISC_H__ */