1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2/*
3 * Copyright (C) 2008 Red Hat, Inc.
4 */
5
6#ifndef __SOUP_METHOD_H__
7#define __SOUP_METHOD_H__ 1
8
9#include <libsoup/soup-types.h>
10#include <libsoup/soup-misc.h>
11
12G_BEGIN_DECLS
13
14/**
15 * SECTION:soup-method
16 * @short_description: HTTP method definitions
17 *
18 * soup-method.h contains a number of defines for standard HTTP and
19 * WebDAV headers. You do not need to use these defines; you can pass
20 * arbitrary strings to soup_message_new() if you prefer.
21 *
22 * The thing that these defines <emphasis>are</emphasis> useful for is
23 * performing quick comparisons against #SoupMessage's %method field;
24 * because that field always contains an interned string, and these
25 * macros return interned strings, you can compare %method directly
26 * against these macros rather than needing to use strcmp(). This is
27 * most useful in SoupServer handlers. Eg:
28 *
29 * <informalexample><programlisting>
30 * if (msg->method != SOUP_METHOD_GET &amp;&amp; msg->method != SOUP_METHOD_HEAD) {
31 * soup_message_set_status (msg, SOUP_METHOD_NOT_IMPLEMENTED);
32 * return;
33 * }
34 * </programlisting></informalexample>
35 **/
36
37#define _SOUP_INTERN_METHOD(method) (_SOUP_ATOMIC_INTERN_STRING (_SOUP_METHOD_##method, #method))
38
39/* HTTP/1.1 methods */
40#define SOUP_METHOD_OPTIONS _SOUP_INTERN_METHOD (OPTIONS)
41#define SOUP_METHOD_GET _SOUP_INTERN_METHOD (GET)
42#define SOUP_METHOD_HEAD _SOUP_INTERN_METHOD (HEAD)
43#define SOUP_METHOD_POST _SOUP_INTERN_METHOD (POST)
44#define SOUP_METHOD_PUT _SOUP_INTERN_METHOD (PUT)
45#define SOUP_METHOD_DELETE _SOUP_INTERN_METHOD (DELETE)
46#define SOUP_METHOD_TRACE _SOUP_INTERN_METHOD (TRACE)
47#define SOUP_METHOD_CONNECT _SOUP_INTERN_METHOD (CONNECT)
48
49/* WebDAV methods */
50#define SOUP_METHOD_PROPFIND _SOUP_INTERN_METHOD (PROPFIND)
51#define SOUP_METHOD_PROPPATCH _SOUP_INTERN_METHOD (PROPPATCH)
52#define SOUP_METHOD_MKCOL _SOUP_INTERN_METHOD (MKCOL)
53#define SOUP_METHOD_COPY _SOUP_INTERN_METHOD (COPY)
54#define SOUP_METHOD_MOVE _SOUP_INTERN_METHOD (MOVE)
55#define SOUP_METHOD_LOCK _SOUP_INTERN_METHOD (LOCK)
56#define SOUP_METHOD_UNLOCK _SOUP_INTERN_METHOD (UNLOCK)
57
58/* Do not use these variables directly; use the macros above, which
59 * ensure that they get initialized properly.
60 */
61SOUP_VAR gpointer _SOUP_METHOD_OPTIONS;
62SOUP_VAR gpointer _SOUP_METHOD_GET;
63SOUP_VAR gpointer _SOUP_METHOD_HEAD;
64SOUP_VAR gpointer _SOUP_METHOD_POST;
65SOUP_VAR gpointer _SOUP_METHOD_PUT;
66SOUP_VAR gpointer _SOUP_METHOD_DELETE;
67SOUP_VAR gpointer _SOUP_METHOD_TRACE;
68SOUP_VAR gpointer _SOUP_METHOD_CONNECT;
69
70SOUP_VAR gpointer _SOUP_METHOD_PROPFIND;
71SOUP_VAR gpointer _SOUP_METHOD_PROPPATCH;
72SOUP_VAR gpointer _SOUP_METHOD_MKCOL;
73SOUP_VAR gpointer _SOUP_METHOD_COPY;
74SOUP_VAR gpointer _SOUP_METHOD_MOVE;
75SOUP_VAR gpointer _SOUP_METHOD_LOCK;
76SOUP_VAR gpointer _SOUP_METHOD_UNLOCK;
77
78G_END_DECLS
79
80#endif /* __SOUP_METHOD_H__ */
81