libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

http_method.h (4955B)


      1 /* SPDX-License-Identifier: LGPL-2.1-or-later OR (GPL-2.0-or-later WITH eCos-exception-2.0) */
      2 /*
      3   This file is part of GNU libmicrohttpd.
      4   Copyright (C) 2021-2024 Evgeny Grin (Karlson2k)
      5 
      6   GNU libmicrohttpd is free software; you can redistribute it and/or
      7   modify it under the terms of the GNU Lesser General Public
      8   License as published by the Free Software Foundation; either
      9   version 2.1 of the License, or (at your option) any later version.
     10 
     11   GNU libmicrohttpd is distributed in the hope that it will be useful,
     12   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14   Lesser General Public License for more details.
     15 
     16   Alternatively, you can redistribute GNU libmicrohttpd and/or
     17   modify it under the terms of the GNU General Public License as
     18   published by the Free Software Foundation; either version 2 of
     19   the License, or (at your option) any later version, together
     20   with the eCos exception, as follows:
     21 
     22     As a special exception, if other files instantiate templates or
     23     use macros or inline functions from this file, or you compile this
     24     file and link it with other works to produce a work based on this
     25     file, this file does not by itself cause the resulting work to be
     26     covered by the GNU General Public License. However the source code
     27     for this file must still be made available in accordance with
     28     section (3) of the GNU General Public License v2.
     29 
     30     This exception does not invalidate any other reasons why a work
     31     based on this file might be covered by the GNU General Public
     32     License.
     33 
     34   You should have received copies of the GNU Lesser General Public
     35   License and the GNU General Public License along with this library;
     36   if not, see <https://www.gnu.org/licenses/>.
     37 */
     38 
     39 /**
     40  * @file src/mhd2/http_method.h
     41  * @brief  The definition of the enums for the HTTP methods
     42  * @author Karlson2k (Evgeny Grin)
     43  */
     44 
     45 #ifndef MHD_HTTP_METHOD_H
     46 #define MHD_HTTP_METHOD_H 1
     47 
     48 #include "mhd_sys_options.h"
     49 
     50 #ifndef MHD_HTTP_METHOD_DEFINED
     51 
     52 enum MHD_FIXED_ENUM_MHD_SET_ MHD_HTTP_Method
     53 {
     54 
     55   /**
     56    * Method did not match any of the methods given below.
     57    */
     58   MHD_HTTP_METHOD_OTHER = 255
     59   ,
     60   /* Main HTTP methods. */
     61 
     62   /**
     63    * "GET"
     64    * Safe.     Idempotent.     RFC9110, Section 9.3.1.
     65    */
     66   MHD_HTTP_METHOD_GET = 1
     67   ,
     68   /**
     69    * "HEAD"
     70    * Safe.     Idempotent.     RFC9110, Section 9.3.2.
     71    */
     72   MHD_HTTP_METHOD_HEAD = 2
     73   ,
     74   /**
     75    * "POST"
     76    * Not safe. Not idempotent. RFC9110, Section 9.3.3.
     77    */
     78   MHD_HTTP_METHOD_POST = 3
     79   ,
     80   /**
     81    * "PUT"
     82    * Not safe. Idempotent.     RFC9110, Section 9.3.4.
     83    */
     84   MHD_HTTP_METHOD_PUT = 4
     85   ,
     86   /**
     87    * "DELETE"
     88    * Not safe. Idempotent.     RFC9110, Section 9.3.5.
     89    */
     90   MHD_HTTP_METHOD_DELETE = 5
     91   ,
     92   /**
     93    * "CONNECT"
     94    * Not safe. Not idempotent. RFC9110, Section 9.3.6.
     95    */
     96   MHD_HTTP_METHOD_CONNECT = 6
     97   ,
     98   /**
     99    * "OPTIONS"
    100    * Safe.     Idempotent.     RFC9110, Section 9.3.7.
    101    */
    102   MHD_HTTP_METHOD_OPTIONS = 7
    103   ,
    104   /**
    105    * "TRACE"
    106    * Safe.     Idempotent.     RFC9110, Section 9.3.8.
    107    */
    108   MHD_HTTP_METHOD_TRACE = 8
    109   ,
    110   /**
    111    * "*"
    112    * Not safe. Not idempotent. RFC9110, Section 18.2.
    113    */
    114   MHD_HTTP_METHOD_ASTERISK = 9
    115 };
    116 
    117 
    118 #define MHD_HTTP_METHOD_DEFINED 1
    119 #endif /* ! MHD_HTTP_METHOD_DEFINED */
    120 
    121 /**
    122  * Internal version of MHD_HTTP_Method
    123  * Extended with the #mhd_HTTP_METHOD_NO_METHOD value
    124  */
    125 enum MHD_FIXED_ENUM_ mhd_HTTP_Method
    126 {
    127 
    128   /**
    129    * No method has been detected yet
    130    */
    131   mhd_HTTP_METHOD_NO_METHOD = 0
    132   ,
    133 
    134   /**
    135    * Method did not match any of the methods given below.
    136    */
    137   mhd_HTTP_METHOD_OTHER = MHD_HTTP_METHOD_OTHER
    138   ,
    139   /* Main HTTP methods. */
    140 
    141   /**
    142    * "GET"
    143    * Safe.     Idempotent.     RFC9110, Section 9.3.1.
    144    */
    145   mhd_HTTP_METHOD_GET = MHD_HTTP_METHOD_GET
    146   ,
    147   /**
    148    * "HEAD"
    149    * Safe.     Idempotent.     RFC9110, Section 9.3.2.
    150    */
    151   mhd_HTTP_METHOD_HEAD = MHD_HTTP_METHOD_HEAD
    152   ,
    153   /**
    154    * "POST"
    155    * Not safe. Not idempotent. RFC9110, Section 9.3.3.
    156    */
    157   mhd_HTTP_METHOD_POST = MHD_HTTP_METHOD_POST
    158   ,
    159   /**
    160    * "PUT"
    161    * Not safe. Idempotent.     RFC9110, Section 9.3.4.
    162    */
    163   mhd_HTTP_METHOD_PUT = MHD_HTTP_METHOD_PUT
    164   ,
    165   /**
    166    * "DELETE"
    167    * Not safe. Idempotent.     RFC9110, Section 9.3.5.
    168    */
    169   mhd_HTTP_METHOD_DELETE = MHD_HTTP_METHOD_DELETE
    170   ,
    171   /**
    172    * "CONNECT"
    173    * Not safe. Not idempotent. RFC9110, Section 9.3.6.
    174    */
    175   mhd_HTTP_METHOD_CONNECT = MHD_HTTP_METHOD_CONNECT
    176   ,
    177   /**
    178    * "OPTIONS"
    179    * Safe.     Idempotent.     RFC9110, Section 9.3.7.
    180    */
    181   mhd_HTTP_METHOD_OPTIONS = MHD_HTTP_METHOD_OPTIONS
    182   ,
    183   /**
    184    * "TRACE"
    185    * Safe.     Idempotent.     RFC9110, Section 9.3.8.
    186    */
    187   mhd_HTTP_METHOD_TRACE = MHD_HTTP_METHOD_TRACE
    188   ,
    189   /**
    190    * "*"
    191    * Not safe. Not idempotent. RFC9110, Section 18.2.
    192    */
    193   mhd_HTTP_METHOD_ASTERISK = MHD_HTTP_METHOD_ASTERISK
    194 };
    195 
    196 #define MHD_HTTP_METHOD_DEFINED 1
    197 #endif /* ! MHD_HTTP_METHOD_H */