mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
http: lws_add_http_header_by_name: add colon if needed
This commit is contained in:
parent
91f0b3bc0f
commit
637ed905af
1 changed files with 7 additions and 2 deletions
|
@ -78,10 +78,15 @@ lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
|
|||
(void)wsi;
|
||||
#endif
|
||||
if (name) {
|
||||
while (*p < end && *name)
|
||||
char has_colon = 0;
|
||||
while (*p < end && *name) {
|
||||
has_colon = has_colon || *name == ':';
|
||||
*((*p)++) = *name++;
|
||||
if (*p == end)
|
||||
}
|
||||
if (*p + (has_colon ? 1 : 2) >= end)
|
||||
return 1;
|
||||
if (!has_colon)
|
||||
*((*p)++) = ':';
|
||||
*((*p)++) = ' ';
|
||||
}
|
||||
if (*p + length + 3 >= end)
|
||||
|
|
Loading…
Add table
Reference in a new issue