+
+ if (csp->client_iob->eod > csp->client_iob->cur)
+ {
+ long bytes_to_shift = csp->client_iob->cur - csp->client_iob->buf;
+ size_t data_length = (size_t)(csp->client_iob->eod - csp->client_iob->cur);
+
+ assert(bytes_to_shift > 0);
+ assert(data_length > 0);
+
+ log_error(LOG_LEVEL_CONNECT, "Shifting %d pipelined bytes by %d bytes",
+ data_length, bytes_to_shift);
+ memmove(csp->client_iob->buf, csp->client_iob->cur, data_length);
+ csp->client_iob->cur = csp->client_iob->buf;
+ assert(csp->client_iob->eod == csp->client_iob->buf + bytes_to_shift + data_length);
+ csp->client_iob->eod = csp->client_iob->buf + data_length;
+ memset(csp->client_iob->eod, '\0', (size_t)bytes_to_shift);
+
+ csp->flags |= CSP_FLAG_PIPELINED_REQUEST_WAITING;
+ }
+ else
+ {
+ /*
+ * We mainly care about resetting client_iob->cur so we don't
+ * waste buffer space at the beginning and don't mess up the
+ * request restoration done by cgi_show_request().
+ *
+ * Freeing the buffer itself isn't technically necessary,
+ * but makes debugging more convenient.
+ */
+ IOB_RESET(csp->client_iob);
+ }