summaryrefslogtreecommitdiff
path: root/libpod/util.go
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-05-08 08:33:44 -0700
committerJhon Honce <jhonce@redhat.com>2020-05-13 11:49:17 -0700
commitb6113e2b9ea8f397e345a09335c26f953994c6f4 (patch)
tree5dfe310f20bc1b0ad5cadb84ef8416253df438ad /libpod/util.go
parentd147b3ee027580dd7afdeb0fa04d990ae1d2ee91 (diff)
downloadpodman-b6113e2b9ea8f397e345a09335c26f953994c6f4.tar.gz
podman-b6113e2b9ea8f397e345a09335c26f953994c6f4.tar.bz2
podman-b6113e2b9ea8f397e345a09335c26f953994c6f4.zip
WIP V2 attach bindings and test
* Add ErrLostSync to report lost of sync when de-mux'ing stream * Add logus.SetLevel(logrus.DebugLevel) when `go test -v` given * Add context to debugging messages Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'libpod/util.go')
-rw-r--r--libpod/util.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/libpod/util.go b/libpod/util.go
index bdfd153ed..ba9f1fa05 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -249,9 +249,8 @@ func hijackWriteErrorAndClose(toWrite error, cid string, terminal bool, httpCon
// length and stream. Accepts an integer indicating which stream we are sending
// to (STDIN = 0, STDOUT = 1, STDERR = 2).
func makeHTTPAttachHeader(stream byte, length uint32) []byte {
- headerBuf := []byte{stream, 0, 0, 0}
- lenBuf := []byte{0, 0, 0, 0}
- binary.BigEndian.PutUint32(lenBuf, length)
- headerBuf = append(headerBuf, lenBuf...)
- return headerBuf
+ header := make([]byte, 8)
+ header[0] = stream
+ binary.BigEndian.PutUint32(header[4:], length)
+ return header
}