• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "constant.h"
17 
18 namespace OHOS::NetStack {
19 const char *const HttpConstant::HTTP_METHOD_GET = "GET";
20 const char *const HttpConstant::HTTP_METHOD_HEAD = "HEAD";
21 const char *const HttpConstant::HTTP_METHOD_OPTIONS = "OPTIONS";
22 const char *const HttpConstant::HTTP_METHOD_TRACE = "TRACE";
23 const char *const HttpConstant::HTTP_METHOD_DELETE = "DELETE";
24 const char *const HttpConstant::HTTP_METHOD_POST = "POST";
25 const char *const HttpConstant::HTTP_METHOD_PUT = "PUT";
26 const char *const HttpConstant::HTTP_METHOD_CONNECT = "CONNECT";
27 
28 const uint32_t HttpConstant::DEFAULT_READ_TIMEOUT = 60000;
29 const uint32_t HttpConstant::DEFAULT_CONNECT_TIMEOUT = 60000;
30 const uint32_t HttpConstant::DEFAULT_IF_MODIFIED_SINCE = 0;
31 const int32_t HttpConstant::DEFAULT_FIXED_LENGTH_STREAMING_MODE = -1;
32 
33 const char *const HttpConstant::PARAM_KEY_METHOD = "method";
34 const char *const HttpConstant::PARAM_KEY_EXTRA_DATA = "extraData";
35 const char *const HttpConstant::PARAM_KEY_HEADER = "header";
36 const char *const HttpConstant::PARAM_KEY_READ_TIMEOUT = "readTimeout";
37 const char *const HttpConstant::PARAM_KEY_CONNECT_TIMEOUT = "connectTimeout";
38 const char *const HttpConstant::PARAM_KEY_IF_MODIFIED_SINCE = "ifModifiedSince";
39 const char *const HttpConstant::PARAM_KEY_FIXED_LENGTH_STREAMING_MODE = "fixedLengthStreamingMode";
40 
41 const char *const HttpConstant::RESPONSE_KEY_RESULT = "result";
42 const char *const HttpConstant::RESPONSE_KEY_RESPONSE_CODE = "responseCode";
43 const char *const HttpConstant::RESPONSE_KEY_HEADER = "header";
44 const char *const HttpConstant::RESPONSE_KEY_COOKIES = "cookies";
45 
46 const char *const HttpConstant::HTTP_URL_PARAM_START = "?";
47 const char *const HttpConstant::HTTP_URL_PARAM_SEPARATOR = "&";
48 const char *const HttpConstant::HTTP_URL_NAME_VALUE_SEPARATOR = "=";
49 const char *const HttpConstant::HTTP_HEADER_SEPARATOR = ":";
50 const char *const HttpConstant::HTTP_LINE_SEPARATOR = "\r\n";
51 
52 const char *const HttpConstant::HTTP_DEFAULT_USER_AGENT = "libcurl-agent/1.0";
53 const char *const HttpConstant::HTTP_DEFAULT_CA_PATH = "/etc/ssl/certs/cacert.pem";
54 
55 const char *const HttpConstant::HTTP_CONTENT_TYPE = "Content-Type";
56 const char *const HttpConstant::HTTP_CONTENT_TYPE_URL_ENCODE = "application/x-www-form-urlencoded";
57 const char *const HttpConstant::HTTP_CONTENT_TYPE_JSON = "application/json";
58 const char *const HttpConstant::HTTP_CONTENT_TYPE_OCTET_STREAM = "application/octet-stream";
59 const char *const HttpConstant::HTTP_CONTENT_TYPE_JPEG_STREAM = "image/jpeg";
60 
61 const char *const HttpConstant::HTTP_CONTENT_ENCODING_GZIP = "gzip";
62 } // namespace OHOS::NetStack