Lines 224-229
AP_DECLARE(apr_status_t) ap_rgetline_core(char **s
Link Here
|
224 |
int do_alloc = (*s == NULL), saw_eos = 0; |
224 |
int do_alloc = (*s == NULL), saw_eos = 0; |
225 |
int fold = flags & AP_GETLINE_FOLD; |
225 |
int fold = flags & AP_GETLINE_FOLD; |
226 |
int crlf = flags & AP_GETLINE_CRLF; |
226 |
int crlf = flags & AP_GETLINE_CRLF; |
|
|
227 |
int nospc_eol = flags & AP_GETLINE_NOSPC_EOL; |
228 |
int eol = 0; |
227 |
|
229 |
|
228 |
if (!n) { |
230 |
if (!n) { |
229 |
/* Needs room for NUL byte at least */ |
231 |
/* Needs room for NUL byte at least */ |
Lines 239-245
AP_DECLARE(apr_status_t) ap_rgetline_core(char **s
Link Here
|
239 |
if (last_char) |
241 |
if (last_char) |
240 |
*last_char = '\0'; |
242 |
*last_char = '\0'; |
241 |
|
243 |
|
242 |
for (;;) { |
244 |
do { |
243 |
apr_brigade_cleanup(bb); |
245 |
apr_brigade_cleanup(bb); |
244 |
rv = ap_get_brigade(r->proto_input_filters, bb, AP_MODE_GETLINE, |
246 |
rv = ap_get_brigade(r->proto_input_filters, bb, AP_MODE_GETLINE, |
245 |
APR_BLOCK_READ, 0); |
247 |
APR_BLOCK_READ, 0); |
Lines 283-290
AP_DECLARE(apr_status_t) ap_rgetline_core(char **s
Link Here
|
283 |
|
285 |
|
284 |
/* Would this overrun our buffer? If so, we'll die. */ |
286 |
/* Would this overrun our buffer? If so, we'll die. */ |
285 |
if (n < bytes_handled + len) { |
287 |
if (n < bytes_handled + len) { |
|
|
288 |
/* But before we'll fill in the buffer up to its limit (i.e. |
289 |
* fall through with the remaining length if necessary), and |
290 |
* optionally (nospc_eol) consume the end of line until LF. |
291 |
*/ |
286 |
rv = APR_ENOSPC; |
292 |
rv = APR_ENOSPC; |
287 |
goto cleanup; |
293 |
eol = (str[len - 1] == APR_ASCII_LF); |
|
|
294 |
len = n - bytes_handled; |
295 |
if (!len) { |
296 |
if (nospc_eol) { |
297 |
continue; |
298 |
} |
299 |
goto cleanup; |
300 |
} |
288 |
} |
301 |
} |
289 |
|
302 |
|
290 |
/* Do we have to handle the allocation ourselves? */ |
303 |
/* Do we have to handle the allocation ourselves? */ |
Lines 323-330
AP_DECLARE(apr_status_t) ap_rgetline_core(char **s
Link Here
|
323 |
|
336 |
|
324 |
/* If we got a full line of input, stop reading */ |
337 |
/* If we got a full line of input, stop reading */ |
325 |
if (last_char && (*last_char == APR_ASCII_LF)) { |
338 |
if (last_char && (*last_char == APR_ASCII_LF)) { |
326 |
break; |
339 |
eol = 1; |
327 |
} |
340 |
} |
|
|
341 |
} while (!eol); |
342 |
|
343 |
if (rv != APR_SUCCESS) { |
344 |
/* End of line after APR_ENOSPC above */ |
345 |
goto cleanup; |
328 |
} |
346 |
} |
329 |
|
347 |
|
330 |
/* Now terminate the string at the end of the line; |
348 |
/* Now terminate the string at the end of the line; |