mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
ss: http: support PATCH
https://github.com/warmcat/libwebsockets/issues/2989
This commit is contained in:
parent
051dfbdb7d
commit
6dfc270232
1 changed files with 14 additions and 2 deletions
|
@ -248,12 +248,13 @@ lws_apply_metadata(lws_ss_handle_t *h, struct lws *wsi, uint8_t *buf,
|
|||
}
|
||||
|
||||
/*
|
||||
* Content-length on POST / PUT if we have the length information
|
||||
* Content-length on POST / PUT / PATCH if we have the length information
|
||||
*/
|
||||
|
||||
if (h->policy->u.http.method && (
|
||||
(!strcmp(h->policy->u.http.method, "POST") ||
|
||||
!strcmp(h->policy->u.http.method, "PUT"))) &&
|
||||
!strcmp(h->policy->u.http.method, "PATCH") ||
|
||||
!strcmp(h->policy->u.http.method, "PUT"))) &&
|
||||
wsi->http.writeable_len) {
|
||||
if (!(h->policy->flags &
|
||||
LWSSSPOLF_HTTP_NO_CONTENT_LENGTH)) {
|
||||
|
@ -830,6 +831,7 @@ malformed:
|
|||
h->policy->protocol == LWSSSP_H2) &&
|
||||
h->being_serialized && (
|
||||
!strcmp(h->policy->u.http.method, "PUT") ||
|
||||
!strcmp(h->policy->u.http.method, "PATCH") ||
|
||||
!strcmp(h->policy->u.http.method, "POST"))) {
|
||||
|
||||
wsi->client_suppress_CONNECTION_ERROR = 1;
|
||||
|
@ -1095,6 +1097,16 @@ malformed:
|
|||
return -1;
|
||||
if (lws_ss_alloc_set_metadata(h, "method", "POST", 4))
|
||||
return -1;
|
||||
} else {
|
||||
m = lws_hdr_total_length(wsi, WSI_TOKEN_PATCH_URI);
|
||||
if (m) {
|
||||
if (lws_ss_alloc_set_metadata(h, "path",
|
||||
lws_hdr_simple_ptr(wsi,
|
||||
WSI_TOKEN_PATCH_URI), (unsigned int)m))
|
||||
return -1;
|
||||
if (lws_ss_alloc_set_metadata(h, "method", "PATCH", 5))
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue