Annotation of libwww/Library/src/HTMethod.html, revision 2.21

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

Webmaster