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

Function send_request

modules/ssl/ssl_util_ocsp.c:67–150  ·  view source on GitHub ↗

Send the OCSP request serialized into BIO 'request' to the * responder at given server given by URI. Returns socket object or * NULL on error. */

Source from the content-addressed store, hash-verified

65 * responder at given server given by URI. Returns socket object or
66 * NULL on error. */
67static apr_socket_t *send_request(BIO *request, const apr_uri_t *uri,
68 apr_interval_time_t timeout,
69 conn_rec *c, apr_pool_t *p,
70 const apr_uri_t *proxy_uri)
71{
72 apr_status_t rv;
73 apr_sockaddr_t *sa;
74 apr_socket_t *sd;
75 char buf[HUGE_STRING_LEN];
76 int len;
77 const apr_uri_t *next_hop_uri;
78
79 if (proxy_uri) {
80 next_hop_uri = proxy_uri;
81 }
82 else {
83 next_hop_uri = uri;
84 }
85
86 rv = apr_sockaddr_info_get(&sa, next_hop_uri->hostname, APR_UNSPEC,
87 next_hop_uri->port, 0, p);
88 if (rv) {
89 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01972)
90 "could not resolve address of %s %s",
91 proxy_uri ? "proxy" : "OCSP responder",
92 next_hop_uri->hostinfo);
93 return NULL;
94 }
95
96 /* establish a connection to the OCSP responder */
97 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(01973)
98 "connecting to %s '%s'",
99 proxy_uri ? "proxy" : "OCSP responder",
100 uri->hostinfo);
101
102 /* Cycle through address until a connect() succeeds. */
103 for (; sa; sa = sa->next) {
104 rv = apr_socket_create(&sd, sa->family, SOCK_STREAM, APR_PROTO_TCP, p);
105 if (rv == APR_SUCCESS) {
106 apr_socket_timeout_set(sd, timeout);
107
108 rv = apr_socket_connect(sd, sa);
109 if (rv == APR_SUCCESS) {
110 break;
111 }
112 apr_socket_close(sd);
113 }
114 }
115
116 if (sa == NULL) {
117 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01974)
118 "could not connect to %s '%s'",
119 proxy_uri ? "proxy" : "OCSP responder",
120 next_hop_uri->hostinfo);
121 return NULL;
122 }
123
124 /* send the request and get a response */

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected