Skip to content

Commit 991e47d

Browse files
committed
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.
1 parent 6057ffc commit 991e47d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/conns.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
#include "main.h"
2525
#include "hsearch.h"
2626

27+
enum connect_method_e {
28+
CM_FALSE = 0,
29+
CM_TRUE = 1,
30+
CM_UPGRADE = 2,
31+
};
32+
2733
/*
2834
* Connection Definition
2935
*/
@@ -37,8 +43,9 @@ struct conn_s {
3743
/* The request line (first line) from the client */
3844
char *request_line;
3945

46+
enum connect_method_e connect_method;
47+
4048
/* Booleans */
41-
unsigned int connect_method;
4249
unsigned int show_stats;
4350

4451
/*

src/reqs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static struct request_s *process_request (struct conn_s *connptr,
454454
goto fail;
455455
}
456456

457-
connptr->connect_method = TRUE;
457+
connptr->connect_method = CM_TRUE;
458458
} else {
459459
#ifdef TRANSPARENT_PROXY
460460
if (!do_transparent_proxy
@@ -1756,7 +1756,7 @@ void handle_connection (struct conn_s *connptr, union sockaddr_union* addr)
17561756
connptr->server_fd);
17571757

17581758
if(orderedmap_find (hashofheaders, "upgrade")) {
1759-
connptr->connect_method = TRUE;
1759+
connptr->connect_method = CM_UPGRADE;
17601760
safe_write (connptr->server_fd, lines, lines_len);
17611761
}
17621762

@@ -1786,6 +1786,8 @@ void handle_connection (struct conn_s *connptr, union sockaddr_union* addr)
17861786

17871787
HC_FAIL();
17881788
}
1789+
} else if (connptr->connect_method == CM_UPGRADE) {
1790+
/* NOP */ ;
17891791
} else {
17901792
if (send_ssl_response (connptr) < 0) {
17911793
log_message (LOG_ERR,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy