connection upgrade: do not emit 200 header when establishing conn
a tri-state connect_method enum was introduced for this purpose. if connect_method is set to CM_UPGRADE, the "HTTP/1.0 200 Connection established" response won't be emitted.
This commit is contained in:
parent
6057ffca80
commit
991e47d8eb
@ -24,6 +24,12 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "hsearch.h"
|
#include "hsearch.h"
|
||||||
|
|
||||||
|
enum connect_method_e {
|
||||||
|
CM_FALSE = 0,
|
||||||
|
CM_TRUE = 1,
|
||||||
|
CM_UPGRADE = 2,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connection Definition
|
* Connection Definition
|
||||||
*/
|
*/
|
||||||
@ -37,8 +43,9 @@ struct conn_s {
|
|||||||
/* The request line (first line) from the client */
|
/* The request line (first line) from the client */
|
||||||
char *request_line;
|
char *request_line;
|
||||||
|
|
||||||
|
enum connect_method_e connect_method;
|
||||||
|
|
||||||
/* Booleans */
|
/* Booleans */
|
||||||
unsigned int connect_method;
|
|
||||||
unsigned int show_stats;
|
unsigned int show_stats;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -454,7 +454,7 @@ BAD_REQUEST_ERROR:
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
connptr->connect_method = TRUE;
|
connptr->connect_method = CM_TRUE;
|
||||||
} else {
|
} else {
|
||||||
#ifdef TRANSPARENT_PROXY
|
#ifdef TRANSPARENT_PROXY
|
||||||
if (!do_transparent_proxy
|
if (!do_transparent_proxy
|
||||||
@ -1756,7 +1756,7 @@ e401:
|
|||||||
connptr->server_fd);
|
connptr->server_fd);
|
||||||
|
|
||||||
if(orderedmap_find (hashofheaders, "upgrade")) {
|
if(orderedmap_find (hashofheaders, "upgrade")) {
|
||||||
connptr->connect_method = TRUE;
|
connptr->connect_method = CM_UPGRADE;
|
||||||
safe_write (connptr->server_fd, lines, lines_len);
|
safe_write (connptr->server_fd, lines, lines_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1786,6 +1786,8 @@ e401:
|
|||||||
|
|
||||||
HC_FAIL();
|
HC_FAIL();
|
||||||
}
|
}
|
||||||
|
} else if (connptr->connect_method == CM_UPGRADE) {
|
||||||
|
/* NOP */ ;
|
||||||
} else {
|
} else {
|
||||||
if (send_ssl_response (connptr) < 0) {
|
if (send_ssl_response (connptr) < 0) {
|
||||||
log_message (LOG_ERR,
|
log_message (LOG_ERR,
|
||||||
|
Loading…
Reference in New Issue
Block a user