Default to TLS for https connections, and fall back to SSLv3 on failure
[libsoup-meego2:libsoup-meego2.git] / libsoup / soup-status.h
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 <glib.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 } SoupKnownStatusCode;
95
96 const char *soup_status_get_phrase (guint status_code);
97 guint       soup_status_proxify    (guint status_code);
98
99 #define SOUP_HTTP_ERROR soup_http_error_quark()
100 GQuark soup_http_error_quark (void);
101
102 G_END_DECLS
103
104 #endif /* SOUP_STATUS_H */