1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18
19#ifndef BRPC_HTTP_METHOD_H
20#define BRPC_HTTP_METHOD_H
21
22namespace brpc {
23
24enum HttpMethod {
25 HTTP_METHOD_DELETE = 0,
26 HTTP_METHOD_GET = 1,
27 HTTP_METHOD_HEAD = 2,
28 HTTP_METHOD_POST = 3,
29 HTTP_METHOD_PUT = 4,
30 HTTP_METHOD_CONNECT = 5,
31 HTTP_METHOD_OPTIONS = 6,
32 HTTP_METHOD_TRACE = 7,
33 HTTP_METHOD_COPY = 8,
34 HTTP_METHOD_LOCK = 9,
35 HTTP_METHOD_MKCOL = 10,
36 HTTP_METHOD_MOVE = 11,
37 HTTP_METHOD_PROPFIND = 12,
38 HTTP_METHOD_PROPPATCH = 13,
39 HTTP_METHOD_SEARCH = 14,
40 HTTP_METHOD_UNLOCK = 15,
41 HTTP_METHOD_REPORT = 16,
42 HTTP_METHOD_MKACTIVITY = 17,
43 HTTP_METHOD_CHECKOUT = 18,
44 HTTP_METHOD_MERGE = 19,
45 HTTP_METHOD_MSEARCH = 20, // M-SEARCH
46 HTTP_METHOD_NOTIFY = 21,
47 HTTP_METHOD_SUBSCRIBE = 22,
48 HTTP_METHOD_UNSUBSCRIBE = 23,
49 HTTP_METHOD_PATCH = 24,
50 HTTP_METHOD_PURGE = 25,
51 HTTP_METHOD_MKCALENDAR = 26
52};
53
54// Returns literal description of `http_method'. "UNKNOWN" on not found.
55const char *HttpMethod2Str(HttpMethod http_method);
56
57// Convert case-insensitive `method_str' to enum HttpMethod.
58// Returns true on success.
59bool Str2HttpMethod(const char* method_str, HttpMethod* method);
60
61} // namespace brpc
62
63#endif //BRPC_HTTP_METHOD_H
64