Skip to content

Commit 289db30

Browse files
committed
uncommon-headers: fix ss changes for PATCH / PUT
1 parent 96c189d commit 289db30

File tree

1 file changed

+8
-2
lines changed
  • lib/secure-streams/protocols

1 file changed

+8
-2
lines changed

lib/secure-streams/protocols/ss-h1.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,11 @@ lws_apply_metadata(lws_ss_handle_t *h, struct lws *wsi, uint8_t *buf,
252252
*/
253253

254254
if (h->policy->u.http.method && (
255-
(!strcmp(h->policy->u.http.method, "POST") ||
255+
#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
256256
!strcmp(h->policy->u.http.method, "PATCH") ||
257-
!strcmp(h->policy->u.http.method, "PUT"))) &&
257+
!strcmp(h->policy->u.http.method, "PUT") ||
258+
#endif
259+
(!strcmp(h->policy->u.http.method, "POST"))) &&
258260
wsi->http.writeable_len) {
259261
if (!(h->policy->flags &
260262
LWSSSPOLF_HTTP_NO_CONTENT_LENGTH)) {
@@ -840,8 +842,10 @@ secstream_h1(struct lws *wsi, enum lws_callback_reasons reason, void *user,
840842
if ((h->policy->protocol == LWSSSP_H1 ||
841843
h->policy->protocol == LWSSSP_H2) &&
842844
h->being_serialized && (
845+
#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
843846
!strcmp(h->policy->u.http.method, "PUT") ||
844847
!strcmp(h->policy->u.http.method, "PATCH") ||
848+
#endif
845849
!strcmp(h->policy->u.http.method, "POST"))) {
846850

847851
wsi->client_suppress_CONNECTION_ERROR = 1;
@@ -1114,6 +1118,7 @@ secstream_h1(struct lws *wsi, enum lws_callback_reasons reason, void *user,
11141118
if (lws_ss_alloc_set_metadata(h, "method", "POST", 4))
11151119
return -1;
11161120
} else {
1121+
#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
11171122
m = lws_hdr_total_length(wsi, WSI_TOKEN_PATCH_URI);
11181123
if (m) {
11191124
if (lws_ss_alloc_set_metadata(h, "path",
@@ -1123,6 +1128,7 @@ secstream_h1(struct lws *wsi, enum lws_callback_reasons reason, void *user,
11231128
if (lws_ss_alloc_set_metadata(h, "method", "PATCH", 5))
11241129
return -1;
11251130
}
1131+
#endif
11261132
}
11271133
}
11281134
}

0 commit comments

Comments
 (0)