Repository: nanomsg/nng (c)

Issue:
nng_msg_clear also clears the header
[`nng_msg_clear` docs](https://nng.nanomsg.org/man/v1.3.0/nng_msg_clear.3.html) state that it only clears the message body, but in 1.3.0 it clears both the body and header.  This was not the case in earlier releases.

## NNG & Platform details.

1.3.0

## Expected Behavior

`nng_msg_clear` only clears the message body and leaves the header untouched.

## Actual Behavior

`nni_msg_clear` now also clears the now inlined header from this CL (https://github.com/nanomsg/nng/commit/abab1392c11395d387e3072c4f5788d284846093#diff-f719e7b45a41a7b3f01eea3660f52434).



Pull request description:
fix #1252
- nng_msg_clear should only clear the message body and not the head.  Add test to verify

fixes #1252 

Patch:
diff --git a/src/core/message.c b/src/core/message.c
index 9241ac65..79031400 100644
--- a/src/core/message.c
+++ b/src/core/message.c
@@ -578,7 +578,6 @@ nni_msg_header_append_u32(nni_msg *m, uint32_t val)
 void
 nni_msg_clear(nni_msg *m)
 {
-	m->m_header_len = 0;
 	nni_chunk_clear(&m->m_body);
 }
 


Test patch:
diff --git a/tests/message.c b/tests/message.c
index 22dd2852..1eda09b1 100644
--- a/tests/message.c
+++ b/tests/message.c
@@ -91,10 +91,13 @@ TestMain("Message Tests", {
 		});
 
 		Convey("Clearing the body works", {
+			nng_msg_header_append(msg, "bogus", 6);
 			So(nng_msg_append(msg, "bogus", 6) == 0);
 			So(nng_msg_len(msg) == 6);
 			nng_msg_clear(msg);
 			So(nng_msg_len(msg) == 0);
+			// It shouldn't clear the header
+			So(nng_msg_header_len(msg) == 6);
 		});
 
 		Convey("We cannot delete more header than exists", {