jpayne@69
|
1 #ifndef CURLINC_HEADER_H
|
jpayne@69
|
2 #define CURLINC_HEADER_H
|
jpayne@69
|
3 /***************************************************************************
|
jpayne@69
|
4 * _ _ ____ _
|
jpayne@69
|
5 * Project ___| | | | _ \| |
|
jpayne@69
|
6 * / __| | | | |_) | |
|
jpayne@69
|
7 * | (__| |_| | _ <| |___
|
jpayne@69
|
8 * \___|\___/|_| \_\_____|
|
jpayne@69
|
9 *
|
jpayne@69
|
10 * Copyright (C) 2018 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
jpayne@69
|
11 *
|
jpayne@69
|
12 * This software is licensed as described in the file COPYING, which
|
jpayne@69
|
13 * you should have received as part of this distribution. The terms
|
jpayne@69
|
14 * are also available at https://curl.se/docs/copyright.html.
|
jpayne@69
|
15 *
|
jpayne@69
|
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
jpayne@69
|
17 * copies of the Software, and permit persons to whom the Software is
|
jpayne@69
|
18 * furnished to do so, under the terms of the COPYING file.
|
jpayne@69
|
19 *
|
jpayne@69
|
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
jpayne@69
|
21 * KIND, either express or implied.
|
jpayne@69
|
22 *
|
jpayne@69
|
23 * SPDX-License-Identifier: curl
|
jpayne@69
|
24 *
|
jpayne@69
|
25 ***************************************************************************/
|
jpayne@69
|
26
|
jpayne@69
|
27 #ifdef __cplusplus
|
jpayne@69
|
28 extern "C" {
|
jpayne@69
|
29 #endif
|
jpayne@69
|
30
|
jpayne@69
|
31 struct curl_header {
|
jpayne@69
|
32 char *name; /* this might not use the same case */
|
jpayne@69
|
33 char *value;
|
jpayne@69
|
34 size_t amount; /* number of headers using this name */
|
jpayne@69
|
35 size_t index; /* ... of this instance, 0 or higher */
|
jpayne@69
|
36 unsigned int origin; /* see bits below */
|
jpayne@69
|
37 void *anchor; /* handle privately used by libcurl */
|
jpayne@69
|
38 };
|
jpayne@69
|
39
|
jpayne@69
|
40 /* 'origin' bits */
|
jpayne@69
|
41 #define CURLH_HEADER (1<<0) /* plain server header */
|
jpayne@69
|
42 #define CURLH_TRAILER (1<<1) /* trailers */
|
jpayne@69
|
43 #define CURLH_CONNECT (1<<2) /* CONNECT headers */
|
jpayne@69
|
44 #define CURLH_1XX (1<<3) /* 1xx headers */
|
jpayne@69
|
45 #define CURLH_PSEUDO (1<<4) /* pseudo headers */
|
jpayne@69
|
46
|
jpayne@69
|
47 typedef enum {
|
jpayne@69
|
48 CURLHE_OK,
|
jpayne@69
|
49 CURLHE_BADINDEX, /* header exists but not with this index */
|
jpayne@69
|
50 CURLHE_MISSING, /* no such header exists */
|
jpayne@69
|
51 CURLHE_NOHEADERS, /* no headers at all exist (yet) */
|
jpayne@69
|
52 CURLHE_NOREQUEST, /* no request with this number was used */
|
jpayne@69
|
53 CURLHE_OUT_OF_MEMORY, /* out of memory while processing */
|
jpayne@69
|
54 CURLHE_BAD_ARGUMENT, /* a function argument was not okay */
|
jpayne@69
|
55 CURLHE_NOT_BUILT_IN /* if API was disabled in the build */
|
jpayne@69
|
56 } CURLHcode;
|
jpayne@69
|
57
|
jpayne@69
|
58 CURL_EXTERN CURLHcode curl_easy_header(CURL *easy,
|
jpayne@69
|
59 const char *name,
|
jpayne@69
|
60 size_t index,
|
jpayne@69
|
61 unsigned int origin,
|
jpayne@69
|
62 int request,
|
jpayne@69
|
63 struct curl_header **hout);
|
jpayne@69
|
64
|
jpayne@69
|
65 CURL_EXTERN struct curl_header *curl_easy_nextheader(CURL *easy,
|
jpayne@69
|
66 unsigned int origin,
|
jpayne@69
|
67 int request,
|
jpayne@69
|
68 struct curl_header *prev);
|
jpayne@69
|
69
|
jpayne@69
|
70 #ifdef __cplusplus
|
jpayne@69
|
71 } /* end of extern "C" */
|
jpayne@69
|
72 #endif
|
jpayne@69
|
73
|
jpayne@69
|
74 #endif /* CURLINC_HEADER_H */
|