diff options
Diffstat (limited to 'inform/codec.go')
-rw-r--r-- | inform/codec.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/inform/codec.go b/inform/codec.go index 8147986..ac49aa1 100644 --- a/inform/codec.go +++ b/inform/codec.go | |||
@@ -2,6 +2,7 @@ package inform | |||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "bytes" | 4 | "bytes" |
5 | "compress/zlib" | ||
5 | "encoding/binary" | 6 | "encoding/binary" |
6 | "errors" | 7 | "errors" |
7 | "io" | 8 | "io" |
@@ -56,7 +57,18 @@ func (c *Codec) Unmarshal(fp io.Reader) (*InformWrapper, error) { | |||
56 | return nil, err | 57 | return nil, err |
57 | } | 58 | } |
58 | } else if w.IsZlibCompressed() { | 59 | } else if w.IsZlibCompressed() { |
59 | return nil, errors.New("payload is zlib compressed, not supported") | 60 | rb := bytes.NewReader(u) |
61 | wb := &bytes.Buffer{} | ||
62 | |||
63 | r, err := zlib.NewReader(rb) | ||
64 | if err != nil { | ||
65 | return nil, err | ||
66 | } | ||
67 | |||
68 | io.Copy(wb, r) | ||
69 | r.Close() | ||
70 | |||
71 | w.Payload = wb.Bytes() | ||
60 | } else { | 72 | } else { |
61 | w.Payload = u | 73 | w.Payload = u |
62 | } | 74 | } |