test server http dont print junk if string too long
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
e7f9232c1a
commit
9d73971cf5
1 changed files with 4 additions and 2 deletions
|
@ -62,7 +62,7 @@ struct serveable {
|
|||
void
|
||||
dump_handshake_info(struct lws *wsi)
|
||||
{
|
||||
int n = 0;
|
||||
int n = 0, len;
|
||||
char buf[256];
|
||||
const unsigned char *c;
|
||||
|
||||
|
@ -73,12 +73,14 @@ dump_handshake_info(struct lws *wsi)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!lws_hdr_total_length(wsi, n)) {
|
||||
len = lws_hdr_total_length(wsi, n);
|
||||
if (!len || len > sizeof(buf) - 1) {
|
||||
n++;
|
||||
continue;
|
||||
}
|
||||
|
||||
lws_hdr_copy(wsi, buf, sizeof buf, n);
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
|
||||
fprintf(stderr, " %s = %s\n", (char *)c, buf);
|
||||
n++;
|
||||
|
|
Loading…
Add table
Reference in a new issue