Annotation of libwww/Library/src/HTMethod.html, revision 2.18
2.17 kirschpi 1: <html>
2: <head>
3: <meta http-equiv="Content-Type" content="text/html">
2.14 frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 1-Jul-1996 -->
2.17 kirschpi 5: <title>W3C Sample Code Library libwww Request Access Methods</title>
6: </head>
7:
8: <body>
9: <h1>Request Access Methods</h1>
10: <pre>/*
2.1 frystyk 11: ** (c) COPYRIGHT MIT 1995.
12: ** Please first read the full copyright statement in the file COPYRIGH.
2.17 kirschpi 13: */</pre>
14:
15: <p>This module keeps a list of valid methods to be performed on a <a
16: href="HTReq.html">request object</a>, for example <b>GET</b>, <b>HEAD</b>,
17: <b>PUT</b>, <b>POST</b>, <b>DELETE</b>, etc. You can assign which method to
18: be performed on the request object <a href="HTReq.html">directly</a> or you
19: can go through the <a href="HTReq.html">Access module</a> for higher level
20: functions.</p>
21:
22: <p>This module is implemented by <a href="HTMethod.c">HTMethod.c</a>, and it
23: is a part of the <a href="http://www.w3.org/Library/"> W3C Sample Code
24: Library</a>.</p>
25: <pre>#ifndef HTMETHOD_H
26: #define HTMETHOD_H</pre>
27:
28: <p><b>NOTE:</b> The anchor list of allowed methods is a bitflag, not at
29: list!</p>
30: <pre>typedef enum {
2.1 frystyk 31: METHOD_INVALID = 0x0,
32: METHOD_GET = 0x1,
33: METHOD_HEAD = 0x2,
34: METHOD_POST = 0x4,
2.13 frystyk 35: METHOD_PUT = 0x8,
36: METHOD_PATCH = 0x10,
37: METHOD_DELETE = 0x20,
38: METHOD_TRACE = 0x40,
39: METHOD_OPTIONS = 0x80,
40: METHOD_LINK = 0x100,
2.17 kirschpi 41:
42: #ifdef HT_DAV
43: METHOD_LOCK = 0x400, /* WebDAV Methods */
44: METHOD_UNLOCK = 0x800,
45:
46: METHOD_PROPFIND = 0x1000,
47: METHOD_PROPPATCH = 0x2000,
48: METHOD_MKCOL = 0x4000,
49: METHOD_COPY = 0x8000,
50: METHOD_MOVE = 0x10000,
51: #endif
52:
53: #ifdef HT_EXT
54: METHOD_EXT_0 = 0x20000, /* Extension methods */
55: METHOD_EXT_1 = 0x40000,
56: METHOD_EXT_2 = 0x80000,
57: METHOD_EXT_3 = 0x100000,
58: METHOD_EXT_4 = 0x200000,
59: METHOD_EXT_5 = 0x400000,
60: METHOD_EXT_6 = 0x800000,
61: #endif
62:
2.13 frystyk 63: METHOD_UNLINK = 0x200
2.17 kirschpi 64:
65: } HTMethod;</pre>
66:
67: <h3>Get Method Enumeration</h3>
68:
69: <p>Gives the enumeration value of the method as a function of the (char *)
70: name.</p>
71: <pre>extern HTMethod HTMethod_enum (const char * name);</pre>
72:
73: <h3>Get Method String</h3>
74:
75: <p>The reverse of <i>HTMethod_enum()</i></p>
76: <pre>extern const char * HTMethod_name (HTMethod method);</pre>
77:
78: <h3>Is Method "Safe"?</h3>
79:
80: <p>If a method is safe, it doesn't produce any side effects on the server</p>
81: <pre>#define HTMethod_isSafe(me) ((me) & (METHOD_GET|METHOD_HEAD))</pre>
82:
83: <h3>Does the Method Replace or Add to Metainformation</h3>
84:
85: <p>Most methods override the current set of metainformation stored in an <a
86: href="HTAnchor.html">anchor</a>. However, a few methods actually only add to
87: the anchor metainformation. We have a small macro to make the distinction.</p>
88: <pre>#define HTMethod_addMeta(me) ((me) & (METHOD_TRACE | METHOD_OPTIONS))</pre>
89:
90: <h3>Does a Method include Entity?</h3>
91:
92: <p>Does a method include an entity to be sent from the client to the
93: server?</p>
94:
95: <p>If not using WebDAV functions, neither extension methods, the
96: HTMethod_hasEntity is not changed, because a macro is much more performant
97: than a function. The function is interesting only when using WebDAV (many
98: methods) or extension methods (in this case, a dynamic structure is
99: needed).</p>
100: <pre>
2.18 ! kirschpi 101: #if defined(HT_DAV) || defined(HT_EXT)
! 102: extern BOOL HTMethod_hasEntity(HTMethod me);
2.17 kirschpi 103: #else
2.18 ! kirschpi 104: #define HTMethod_hasEntity(me) ((me) & (METHOD_PUT | METHOD_POST))
2.17 kirschpi 105: #endif</pre>
106:
107: <h3>Extension Methods</h3>
108:
109: <p>These methods have been introduced in Libwww for extension purposes.
110: Through these methods, application may register new methods, even libwww
111: unknown methods, and use them. It's recomended for applications that need
112: only a few new methods, that aren't yet in the libwww. The application should
113: register the desired methos, an before finish, it must unregister these
114: methods.</p>
115: <pre>#ifdef HT_EXT
116: extern BOOL HTMethod_setExtensionMethod (HTMethod method, const char * name, BOOL hasEntity);
117: extern BOOL HTMethod_deleteExtensionMethod (HTMethod method);
118: #endif</pre>
119:
120: <p></p>
121: <pre>#endif /* HTMETHOD_H */</pre>
122:
123: <p></p>
124: <hr>
125: <address>
126: @(#) $Id: HTMethod.html,v 2.16 1998/05/14 02:10:45 frystyk Exp $
127: </address>
128: </body>
129: </html>
Webmaster