- /* buffer up the data we just read */
- add_to_iob(csp, buf, len);
+ /*
+ * buffer up the data we just read. If that fails,
+ * there's little we can do but send our static
+ * out-of-memory page.
+ */
+ if (add_to_iob(csp, buf, len))
+ {
+ log_error(LOG_LEVEL_ERROR, "Out of memory while looking for end of server headers.");
+ rsp = cgi_error_memory();
+
+ if (write_socket(csp->cfd, rsp->head, rsp->head_length)
+ || write_socket(csp->cfd, rsp->body, rsp->content_length))
+ {
+ log_error(LOG_LEVEL_ERROR, "write to: %s failed: %E", http->host);
+ }
+ return;
+ }