MCPcopy Create free account
hub / github.com/apache/httpd / serialize_request

Function serialize_request

modules/ssl/ssl_util_ocsp.c:30–62  ·  view source on GitHub ↗

Serialize an OCSP request which will be sent to the responder at * given URI to a memory BIO object, which is returned. */

Source from the content-addressed store, hash-verified

28/* Serialize an OCSP request which will be sent to the responder at
29 * given URI to a memory BIO object, which is returned. */
30static BIO *serialize_request(OCSP_REQUEST *req, const apr_uri_t *uri,
31 const apr_uri_t *proxy_uri)
32{
33 BIO *bio;
34 int len;
35
36 len = i2d_OCSP_REQUEST(req, NULL);
37
38 bio = BIO_new(BIO_s_mem());
39
40 BIO_printf(bio, "POST ");
41 /* Use full URL instead of URI in case of a request through a proxy */
42 if (proxy_uri) {
43 BIO_printf(bio, "http://%s:%d",
44 uri->hostname, uri->port);
45 }
46 BIO_printf(bio, "%s%s%s HTTP/1.0\r\n"
47 "Host: %s:%d\r\n"
48 "Content-Type: application/ocsp-request\r\n"
49 "Connection: close\r\n"
50 "Content-Length: %d\r\n"
51 "\r\n",
52 uri->path ? uri->path : "/",
53 uri->query ? "?" : "", uri->query ? uri->query : "",
54 uri->hostname, uri->port, len);
55
56 if (i2d_OCSP_REQUEST_bio(bio, req) != 1) {
57 BIO_free(bio);
58 return NULL;
59 }
60
61 return bio;
62}
63
64/* Send the OCSP request serialized into BIO 'request' to the
65 * responder at given server given by URI. Returns socket object or

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected