diff --git a/server/client.go b/server/client.go index 3c3a6d5eed2..5099969be15 100644 --- a/server/client.go +++ b/server/client.go @@ -4051,7 +4051,8 @@ func (c *client) processInboundClientMsg(msg []byte) (bool, bool) { c.mu.Lock() if c.opts.NoResponders { if sub := c.subForReply(c.pa.reply); sub != nil { - proto := fmt.Sprintf("HMSG %s %s 16 16\r\nNATS/1.0 503\r\n\r\n\r\n", c.pa.reply, sub.sid) + hdrLen := 32 /* header without the subject */ + len(c.pa.subject) + proto := fmt.Sprintf("HMSG %s %s %d %d\r\nNATS/1.0 503\r\nNats-Subject: %s\r\n\r\n\r\n", c.pa.reply, sub.sid, hdrLen, hdrLen, c.pa.subject) c.queueOutbound([]byte(proto)) c.addToPCD(c) } diff --git a/server/client_test.go b/server/client_test.go index a0a17799e67..4fadfbd73b6 100644 --- a/server/client_test.go +++ b/server/client_test.go @@ -252,7 +252,7 @@ func TestClientNoResponderSupport(t *testing.T) { if len(am) == 0 { t.Fatalf("Did not get a match for %q", l) } - checkPayload(cr, []byte("NATS/1.0 503\r\n\r\n"), t) + checkPayload(cr, []byte("NATS/1.0 503\r\nNats-Subject: foo\r\n\r\n\r\n"), t) } func TestServerHeaderSupport(t *testing.T) {