From cefca8ad9134c32d780e1b48699efc463fa48bf8 Mon Sep 17 00:00:00 2001 From: brent saner Date: Tue, 30 Sep 2025 14:15:00 -0400 Subject: [PATCH] v1.0.3 FIXED: * Link in README * ReadConnResponse was not properly reading in the response status byte before checking the checksum, leading to receiving/parsing Response messages from a net.Conn *always* failing with an errs.ErrBadHdr. This has been rectified. --- README.adoc | 3 +++ README.html | 13 +++++++++++-- README.md | 10 ++++++++++ funcs.go | 10 +++++++++- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index 6a0f767..033c74f 100644 --- a/README.adoc +++ b/README.adoc @@ -57,3 +57,6 @@ The following are a wishlist or things planned that may come in later versions. ** This of course won't work for serializing and keeping *order* of children (e.g. RG => Record); that'd still need to be ordered, but it will allow for parallel parsing *of* those children. Should benchmark, though; it may not be worth it. * `context.Context` support for `Read*` and `Write*` funcs ** This is a relatively low priority as the passed `net.Conn` will likely return an error if its own context is canceled. This can be handled in the caller downstream. +* `.Append*()` methods to append any type to any parent type. e.g. `.AppendFVP()` would append an FVP to the most recent ResponseRecord to the most recent ResponseRecordGroup (or create if they don't exist), `.AppendRecord(...)` for appending a record to most recent record group etc. +* Better/more strict interfaces +* Maps should be `any`, not `interface{}` values diff --git a/README.html b/README.html index 07f192a..d43ea29 100644 --- a/README.html +++ b/README.html @@ -559,7 +559,7 @@ pre.rouge .gs {
Brent Saner

-Last rendered 2025-09-24 17:00:17 -0400 +Last rendered 2025-09-30 14:15:01 -0400
Table of Contents
@@ -659,6 +659,15 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+
  • +

    .Append*() methods to append any type to any parent type. e.g. <Response>.AppendFVP(<FieldValuePair>) would append an FVP to the most recent ResponseRecord to the most recent ResponseRecordGroup (or create if they don’t exist), <Response>.AppendRecord(…​) for appending a record to most recent record group etc.

    +
  • +
  • +

    Better/more strict interfaces

    +
  • +
  • +

    Maps should be any, not interface{} values

    +
  • @@ -666,7 +675,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND diff --git a/README.md b/README.md index 31bcbce..a423b45 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,13 @@ versions. - This is a relatively low priority as the passed `net.Conn` will likely return an error if its own context is canceled. This can be handled in the caller downstream. + +- `.Append*()` methods to append any type to any parent type. e.g. + `.AppendFVP()` would append an FVP to the + most recent ResponseRecord to the most recent ResponseRecordGroup + (or create if they don’t exist), `.AppendRecord(…​)` for + appending a record to most recent record group etc. + +- Better/more strict interfaces + +- Maps should be `any`, not `interface{}` values diff --git a/funcs.go b/funcs.go index a0018a7..2deb2e8 100644 --- a/funcs.go +++ b/funcs.go @@ -92,7 +92,15 @@ func ReadConnResponse(conn net.Conn) (resp *Response, err error) { var size int var buf *bytes.Buffer = new(bytes.Buffer) - // First get the checksum. + // Buffer in the status byte... + b = make([]byte, 1) + if _, err = conn.Read(b); err != nil { + return + } + if _, err = buf.Write(b); err != nil { + return + } + // Then get the checksum. Per spec, *all* responses *must* have a checksum. b = make([]byte, len(hdrCKSUM)) if _, err = conn.Read(b); err != nil { return