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

Function get_line

modules/ssl/ssl_util_ocsp.c:154–195  ·  view source on GitHub ↗

Return a pool-allocated NUL-terminated line, with CRLF stripped, * read from brigade 'bbin' using 'bbout' as temporary storage. */

Source from the content-addressed store, hash-verified

152/* Return a pool-allocated NUL-terminated line, with CRLF stripped,
153 * read from brigade 'bbin' using 'bbout' as temporary storage. */
154static char *get_line(apr_bucket_brigade *bbout, apr_bucket_brigade *bbin,
155 conn_rec *c, apr_pool_t *p)
156{
157 apr_status_t rv;
158 apr_size_t len;
159 char *line;
160
161 apr_brigade_cleanup(bbout);
162
163 rv = apr_brigade_split_line(bbout, bbin, APR_BLOCK_READ, 8192);
164 if (rv) {
165 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01977)
166 "failed reading line from OCSP server");
167 return NULL;
168 }
169
170 rv = apr_brigade_pflatten(bbout, &line, &len, p);
171 if (rv) {
172 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01978)
173 "failed reading line from OCSP server");
174 return NULL;
175 }
176
177 if (len == 0) {
178 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(02321)
179 "empty response from OCSP server");
180 return NULL;
181 }
182
183 if (line[len-1] != APR_ASCII_LF) {
184 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, APLOGNO(01979)
185 "response header line too long from OCSP server");
186 return NULL;
187 }
188
189 line[len-1] = '\0';
190 if (len > 1 && line[len-2] == APR_ASCII_CR) {
191 line[len-2] = '\0';
192 }
193
194 return line;
195}
196
197/* Maximum values to prevent eating RAM forever. */
198#define MAX_HEADERS (256)

Callers 1

read_responseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected