1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
2 | /* |
3 | * soup-status.h: HTTP status code and status class definitions |
4 | * |
5 | * Copyright (C) 2001-2003, Ximian, Inc. |
6 | */ |
7 | |
8 | #ifndef __SOUP_STATUS_H__ |
9 | #define __SOUP_STATUS_H__ 1 |
10 | |
11 | #include <libsoup/soup-version.h> |
12 | |
13 | G_BEGIN_DECLS |
14 | |
15 | #define SOUP_STATUS_IS_TRANSPORT_ERROR(status) ((status) > 0 && (status) < 100) |
16 | #define SOUP_STATUS_IS_INFORMATIONAL(status) ((status) >= 100 && (status) < 200) |
17 | #define SOUP_STATUS_IS_SUCCESSFUL(status) ((status) >= 200 && (status) < 300) |
18 | #define SOUP_STATUS_IS_REDIRECTION(status) ((status) >= 300 && (status) < 400) |
19 | #define SOUP_STATUS_IS_CLIENT_ERROR(status) ((status) >= 400 && (status) < 500) |
20 | #define SOUP_STATUS_IS_SERVER_ERROR(status) ((status) >= 500 && (status) < 600) |
21 | |
22 | typedef enum { |
23 | SOUP_STATUS_NONE, |
24 | |
25 | /* Transport Errors */ |
26 | SOUP_STATUS_CANCELLED = 1, |
27 | SOUP_STATUS_CANT_RESOLVE, |
28 | SOUP_STATUS_CANT_RESOLVE_PROXY, |
29 | SOUP_STATUS_CANT_CONNECT, |
30 | SOUP_STATUS_CANT_CONNECT_PROXY, |
31 | SOUP_STATUS_SSL_FAILED, |
32 | SOUP_STATUS_IO_ERROR, |
33 | SOUP_STATUS_MALFORMED, |
34 | SOUP_STATUS_TRY_AGAIN, |
35 | SOUP_STATUS_TOO_MANY_REDIRECTS, |
36 | SOUP_STATUS_TLS_FAILED, |
37 | |
38 | /* HTTP Status Codes */ |
39 | SOUP_STATUS_CONTINUE = 100, |
40 | SOUP_STATUS_SWITCHING_PROTOCOLS = 101, |
41 | SOUP_STATUS_PROCESSING = 102, /* WebDAV */ |
42 | |
43 | SOUP_STATUS_OK = 200, |
44 | SOUP_STATUS_CREATED = 201, |
45 | SOUP_STATUS_ACCEPTED = 202, |
46 | SOUP_STATUS_NON_AUTHORITATIVE = 203, |
47 | SOUP_STATUS_NO_CONTENT = 204, |
48 | SOUP_STATUS_RESET_CONTENT = 205, |
49 | SOUP_STATUS_PARTIAL_CONTENT = 206, |
50 | SOUP_STATUS_MULTI_STATUS = 207, /* WebDAV */ |
51 | |
52 | SOUP_STATUS_MULTIPLE_CHOICES = 300, |
53 | SOUP_STATUS_MOVED_PERMANENTLY = 301, |
54 | SOUP_STATUS_FOUND = 302, |
55 | SOUP_STATUS_MOVED_TEMPORARILY = 302, /* RFC 2068 */ |
56 | SOUP_STATUS_SEE_OTHER = 303, |
57 | SOUP_STATUS_NOT_MODIFIED = 304, |
58 | SOUP_STATUS_USE_PROXY = 305, |
59 | SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL = 306, /* (reserved) */ |
60 | SOUP_STATUS_TEMPORARY_REDIRECT = 307, |
61 | |
62 | SOUP_STATUS_BAD_REQUEST = 400, |
63 | SOUP_STATUS_UNAUTHORIZED = 401, |
64 | SOUP_STATUS_PAYMENT_REQUIRED = 402, /* (reserved) */ |
65 | SOUP_STATUS_FORBIDDEN = 403, |
66 | SOUP_STATUS_NOT_FOUND = 404, |
67 | SOUP_STATUS_METHOD_NOT_ALLOWED = 405, |
68 | SOUP_STATUS_NOT_ACCEPTABLE = 406, |
69 | SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407, |
70 | SOUP_STATUS_PROXY_UNAUTHORIZED = SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED, |
71 | SOUP_STATUS_REQUEST_TIMEOUT = 408, |
72 | SOUP_STATUS_CONFLICT = 409, |
73 | SOUP_STATUS_GONE = 410, |
74 | SOUP_STATUS_LENGTH_REQUIRED = 411, |
75 | SOUP_STATUS_PRECONDITION_FAILED = 412, |
76 | SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413, |
77 | SOUP_STATUS_REQUEST_URI_TOO_LONG = 414, |
78 | SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415, |
79 | SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416, |
80 | SOUP_STATUS_INVALID_RANGE = SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE, |
81 | SOUP_STATUS_EXPECTATION_FAILED = 417, |
82 | SOUP_STATUS_UNPROCESSABLE_ENTITY = 422, /* WebDAV */ |
83 | SOUP_STATUS_LOCKED = 423, /* WebDAV */ |
84 | SOUP_STATUS_FAILED_DEPENDENCY = 424, /* WebDAV */ |
85 | |
86 | SOUP_STATUS_INTERNAL_SERVER_ERROR = 500, |
87 | SOUP_STATUS_NOT_IMPLEMENTED = 501, |
88 | SOUP_STATUS_BAD_GATEWAY = 502, |
89 | SOUP_STATUS_SERVICE_UNAVAILABLE = 503, |
90 | SOUP_STATUS_GATEWAY_TIMEOUT = 504, |
91 | SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505, |
92 | SOUP_STATUS_INSUFFICIENT_STORAGE = 507, /* WebDAV search */ |
93 | SOUP_STATUS_NOT_EXTENDED = 510 /* RFC 2774 */ |
94 | } SoupStatus; |
95 | |
96 | SOUP_AVAILABLE_IN_2_4 |
97 | const char *soup_status_get_phrase (guint status_code); |
98 | SOUP_AVAILABLE_IN_2_26 |
99 | guint soup_status_proxify (guint status_code); |
100 | |
101 | #define SOUP_HTTP_ERROR soup_http_error_quark() |
102 | SOUP_AVAILABLE_IN_2_4 |
103 | GQuark soup_http_error_quark (void); |
104 | |
105 | #ifndef SOUP_DISABLE_DEPRECATED |
106 | /* For introspection purposes, we create a duplicate enum type under |
107 | * the deprecated type name, since some (all?) bindings don't handle |
108 | * enum type typedefs the way we want. |
109 | */ |
110 | typedef enum { |
111 | SOUP_KNOWN_STATUS_CODE_NONE, |
112 | |
113 | SOUP_KNOWN_STATUS_CODE_CANCELLED = 1, |
114 | SOUP_KNOWN_STATUS_CODE_CANT_RESOLVE, |
115 | SOUP_KNOWN_STATUS_CODE_CANT_RESOLVE_PROXY, |
116 | SOUP_KNOWN_STATUS_CODE_CANT_CONNECT, |
117 | SOUP_KNOWN_STATUS_CODE_CANT_CONNECT_PROXY, |
118 | SOUP_KNOWN_STATUS_CODE_SSL_FAILED, |
119 | SOUP_KNOWN_STATUS_CODE_IO_ERROR, |
120 | SOUP_KNOWN_STATUS_CODE_MALFORMED, |
121 | SOUP_KNOWN_STATUS_CODE_TRY_AGAIN, |
122 | SOUP_KNOWN_STATUS_CODE_TOO_MANY_REDIRECTS, |
123 | SOUP_KNOWN_STATUS_CODE_TLS_FAILED, |
124 | |
125 | SOUP_KNOWN_STATUS_CODE_CONTINUE = 100, |
126 | SOUP_KNOWN_STATUS_CODE_SWITCHING_PROTOCOLS = 101, |
127 | SOUP_KNOWN_STATUS_CODE_PROCESSING = 102, |
128 | |
129 | SOUP_KNOWN_STATUS_CODE_OK = 200, |
130 | SOUP_KNOWN_STATUS_CODE_CREATED = 201, |
131 | SOUP_KNOWN_STATUS_CODE_ACCEPTED = 202, |
132 | SOUP_KNOWN_STATUS_CODE_NON_AUTHORITATIVE = 203, |
133 | SOUP_KNOWN_STATUS_CODE_NO_CONTENT = 204, |
134 | SOUP_KNOWN_STATUS_CODE_RESET_CONTENT = 205, |
135 | SOUP_KNOWN_STATUS_CODE_PARTIAL_CONTENT = 206, |
136 | SOUP_KNOWN_STATUS_CODE_MULTI_STATUS = 207, |
137 | |
138 | SOUP_KNOWN_STATUS_CODE_MULTIPLE_CHOICES = 300, |
139 | SOUP_KNOWN_STATUS_CODE_MOVED_PERMANENTLY = 301, |
140 | SOUP_KNOWN_STATUS_CODE_FOUND = 302, |
141 | SOUP_KNOWN_STATUS_CODE_MOVED_TEMPORARILY = 302, |
142 | SOUP_KNOWN_STATUS_CODE_SEE_OTHER = 303, |
143 | SOUP_KNOWN_STATUS_CODE_NOT_MODIFIED = 304, |
144 | SOUP_KNOWN_STATUS_CODE_USE_PROXY = 305, |
145 | SOUP_KNOWN_STATUS_CODE_NOT_APPEARING_IN_THIS_PROTOCOL = 306, |
146 | SOUP_KNOWN_STATUS_CODE_TEMPORARY_REDIRECT = 307, |
147 | |
148 | SOUP_KNOWN_STATUS_CODE_BAD_REQUEST = 400, |
149 | SOUP_KNOWN_STATUS_CODE_UNAUTHORIZED = 401, |
150 | SOUP_KNOWN_STATUS_CODE_PAYMENT_REQUIRED = 402, |
151 | SOUP_KNOWN_STATUS_CODE_FORBIDDEN = 403, |
152 | SOUP_KNOWN_STATUS_CODE_NOT_FOUND = 404, |
153 | SOUP_KNOWN_STATUS_CODE_METHOD_NOT_ALLOWED = 405, |
154 | SOUP_KNOWN_STATUS_CODE_NOT_ACCEPTABLE = 406, |
155 | SOUP_KNOWN_STATUS_CODE_PROXY_AUTHENTICATION_REQUIRED = 407, |
156 | SOUP_KNOWN_STATUS_CODE_PROXY_UNAUTHORIZED = SOUP_KNOWN_STATUS_CODE_PROXY_AUTHENTICATION_REQUIRED, |
157 | SOUP_KNOWN_STATUS_CODE_REQUEST_TIMEOUT = 408, |
158 | SOUP_KNOWN_STATUS_CODE_CONFLICT = 409, |
159 | SOUP_KNOWN_STATUS_CODE_GONE = 410, |
160 | SOUP_KNOWN_STATUS_CODE_LENGTH_REQUIRED = 411, |
161 | SOUP_KNOWN_STATUS_CODE_PRECONDITION_FAILED = 412, |
162 | SOUP_KNOWN_STATUS_CODE_REQUEST_ENTITY_TOO_LARGE = 413, |
163 | SOUP_KNOWN_STATUS_CODE_REQUEST_URI_TOO_LONG = 414, |
164 | SOUP_KNOWN_STATUS_CODE_UNSUPPORTED_MEDIA_TYPE = 415, |
165 | SOUP_KNOWN_STATUS_CODE_REQUESTED_RANGE_NOT_SATISFIABLE = 416, |
166 | SOUP_KNOWN_STATUS_CODE_INVALID_RANGE = SOUP_KNOWN_STATUS_CODE_REQUESTED_RANGE_NOT_SATISFIABLE, |
167 | SOUP_KNOWN_STATUS_CODE_EXPECTATION_FAILED = 417, |
168 | SOUP_KNOWN_STATUS_CODE_UNPROCESSABLE_ENTITY = 422, |
169 | SOUP_KNOWN_STATUS_CODE_LOCKED = 423, |
170 | SOUP_KNOWN_STATUS_CODE_FAILED_DEPENDENCY = 424, |
171 | |
172 | SOUP_KNOWN_STATUS_CODE_INTERNAL_SERVER_ERROR = 500, |
173 | SOUP_KNOWN_STATUS_CODE_NOT_IMPLEMENTED = 501, |
174 | SOUP_KNOWN_STATUS_CODE_BAD_GATEWAY = 502, |
175 | SOUP_KNOWN_STATUS_CODE_SERVICE_UNAVAILABLE = 503, |
176 | SOUP_KNOWN_STATUS_CODE_GATEWAY_TIMEOUT = 504, |
177 | SOUP_KNOWN_STATUS_CODE_HTTP_VERSION_NOT_SUPPORTED = 505, |
178 | SOUP_KNOWN_STATUS_CODE_INSUFFICIENT_STORAGE = 507, |
179 | SOUP_KNOWN_STATUS_CODE_NOT_EXTENDED = 510 |
180 | } SoupKnownStatusCode; |
181 | #endif |
182 | |
183 | G_END_DECLS |
184 | |
185 | #endif /* __SOUP_STATUS_H__ */ |
186 | |