ssl_send_certificate_error(): Respect HEAD requests by not sending a body
authorFabian Keil <fk@fabiankeil.de>
Wed, 10 Feb 2021 02:39:23 +0000 (03:39 +0100)
committerFabian Keil <fk@fabiankeil.de>
Sun, 21 Feb 2021 15:09:20 +0000 (16:09 +0100)
ssl_common.c

index ac146f8..a8dd371 100644 (file)
@@ -405,6 +405,16 @@ extern void ssl_send_certificate_error(struct client_state *csp)
    }
    strlcat(message, message_end, message_len);
 
+   if (0 == strcmpic(csp->http->gpc, "HEAD"))
+   {
+      /* Cut off body */
+      char *header_end = strstr(message, "\r\n\r\n");
+      if (header_end != NULL)
+      {
+         header_end[3] = '\0';
+      }
+   }
+
    /*
     * Sending final message to client
     */