source: mod_gnutls/src/gnutls_util.h @ eee1432

debian/masterdebian/stretch-backportsupstream
Last change on this file since eee1432 was 16ad0eb, checked in by Thomas Klute <thomas2.klute@…>, 3 years ago

Perform OCSP request over HTTP

Finally the whole stack is there! Quite a bit of polishing left to do
(especially regarding timing/timeouts), but sending a request and
caching the response work.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/**
2 *  Copyright 2016 Thomas Klute
3 *
4 *  Licensed under the Apache License, Version 2.0 (the "License");
5 *  you may not use this file except in compliance with the License.
6 *  You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 */
16
17#include <apr_buckets.h>
18#include <apr_lib.h>
19#include <apr_network_io.h>
20#include <apr_pools.h>
21#include <apr_uri.h>
22#include <gnutls/gnutls.h>
23
24#ifndef __MOD_GNUTLS_UTIL_H__
25#define __MOD_GNUTLS_UTIL_H__
26
27/* maximum allowed length of one header line */
28#define HTTP_HDR_LINE_MAX 1024
29
30/**
31 * Create an HTTP header to send a POST request with 'size' bytes of
32 * data to 'uri'.
33 */
34const char* http_post_header(apr_pool_t *p, apr_uri_t *uri,
35                             const char *content_type, const char *accept,
36                             apr_size_t size)
37    __attribute__((nonnull(1, 2, 3)));
38
39/**
40 * Try to transfer one header line from 'sockb' into 'lineb', then
41 * return it from there. The line may be no more than
42 * HTTP_HDR_LINE_MAX bytes long, including the terminating CRLF. CR is
43 * replaced with \0 so the line can be processed as a string without
44 * breaks. 'lineb' is flushed before reading the line. Returns either
45 * a pointer to the line (allocated from 'p'), or NULL in case of an
46 * error.
47 */
48const char* read_line(apr_pool_t *p, apr_bucket_brigade *sockb,
49                      apr_bucket_brigade *lineb)
50    __attribute__((nonnull));
51
52/**
53 * Send 'size' bytes from 'buf' over 'sock', using partial send
54 * operations if necessary. Returns APR_SUCCESS or an APR error code
55 * returned by apr_socket_send().
56 */
57apr_status_t sock_send_buf(apr_socket_t *sock, const char *buf,
58                           const apr_size_t size)
59    __attribute__((nonnull));
60
61/**
62 * Read a file into a gnutls_datum_t, allocate necessary memory from
63 * the pool.
64 */
65apr_status_t datum_from_file(apr_pool_t *p, const char* filename,
66                             gnutls_datum_t *datum)
67    __attribute__((nonnull));
68
69#endif /* __MOD_GNUTLS_UTIL_H__ */
Note: See TracBrowser for help on using the repository browser.