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

Function ap_varbuf_cfg_getline

server/util.c:1207–1246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1205}
1206
1207AP_DECLARE(apr_status_t) ap_varbuf_cfg_getline(struct ap_varbuf *vb,
1208 ap_configfile_t *cfp,
1209 apr_size_t max_len)
1210{
1211 apr_status_t rc;
1212 apr_size_t new_len;
1213 vb->strlen = 0;
1214 *vb->buf = '\0';
1215
1216 if (vb->strlen == AP_VARBUF_UNKNOWN)
1217 vb->strlen = strlen(vb->buf);
1218 if (vb->avail - vb->strlen < 3) {
1219 new_len = vb->avail * 2;
1220 if (new_len > max_len)
1221 new_len = max_len;
1222 else if (new_len < 3)
1223 new_len = 3;
1224 ap_varbuf_grow(vb, new_len);
1225 }
1226
1227 for (;;) {
1228 rc = ap_cfg_getline_core(vb->buf, vb->avail, vb->strlen, cfp);
1229 if (rc == APR_ENOSPC || rc == APR_SUCCESS)
1230 vb->strlen += strlen(vb->buf + vb->strlen);
1231 if (rc != APR_ENOSPC)
1232 break;
1233 if (vb->avail >= max_len)
1234 return APR_ENOSPC;
1235 new_len = vb->avail * 2;
1236 if (new_len > max_len)
1237 new_len = max_len;
1238 ap_varbuf_grow(vb, new_len);
1239 --cfp->line_number;
1240 }
1241 if (vb->strlen > max_len)
1242 return APR_ENOSPC;
1243 if (rc == APR_SUCCESS)
1244 vb->strlen = cfg_trim_line(vb->buf);
1245 return rc;
1246}
1247
1248/* Size an HTTP header field list item, as separated by a comma.
1249 * The return value is a pointer to the beginning of the non-empty list item

Callers 4

groups_for_userFunction · 0.85
ap_build_cont_configFunction · 0.85
ap_build_configFunction · 0.85
ap_soak_end_containerFunction · 0.85

Calls 3

ap_varbuf_growFunction · 0.85
ap_cfg_getline_coreFunction · 0.85
cfg_trim_lineFunction · 0.85

Tested by

no test coverage detected