These don't check that they're entirely correct as required by HTTP
specifications. They're mainly there as a quick check that if the caller
didn't validate the key/value in any way, we'll crash instead of creating
a potential security hole. (Because with line feeds the attacker could
add extra headers or even entirely new HTTP requests.)
/* allow calling for retries */
req->state == HTTP_REQUEST_STATE_GOT_RESPONSE ||
req->state == HTTP_REQUEST_STATE_ABORTED);
+ /* make sure key or value can't break HTTP headers entirely */
+ i_assert(strpbrk(key, ":\r\n") == NULL);
+ i_assert(strpbrk(value, "\r\n") == NULL);
/* mark presence of special headers */
switch (key[0]) {