MCPcopy Create free account
hub / github.com/imroc/req / startWriteDataPadded

Method startWriteDataPadded

internal/http2/frame.go:731–762  ·  view source on GitHub ↗

startWriteDataPadded is WriteDataPadded, but only writes the frame to the Framer's internal buffer. The caller should call endWrite to flush the frame to the underlying writer.

(streamID uint32, endStream bool, data, pad []byte)

Source from the content-addressed store, hash-verified

729// startWriteDataPadded is WriteDataPadded, but only writes the frame to the Framer's internal buffer.
730// The caller should call endWrite to flush the frame to the underlying writer.
731func (h2f *Framer) startWriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error {
732 if !validStreamID(streamID) && !h2f.AllowIllegalWrites {
733 return errStreamID
734 }
735 if len(pad) > 0 {
736 if len(pad) > 255 {
737 return errPadLength
738 }
739 if !h2f.AllowIllegalWrites {
740 for _, b := range pad {
741 if b != 0 {
742 // "Padding octets MUST be set to zero when sending."
743 return errPadBytes
744 }
745 }
746 }
747 }
748 var flags Flags
749 if endStream {
750 flags |= FlagDataEndStream
751 }
752 if pad != nil {
753 flags |= FlagDataPadded
754 }
755 h2f.startWrite(FrameData, flags, streamID)
756 if pad != nil {
757 h2f.wbuf = append(h2f.wbuf, byte(len(pad)))
758 }
759 h2f.wbuf = append(h2f.wbuf, data...)
760 h2f.wbuf = append(h2f.wbuf, pad...)
761 return nil
762}
763
764// A SettingsFrame conveys configuration parameters that affect how
765// endpoints communicate, such as preferences and constraints on peer

Callers 1

WriteDataPaddedMethod · 0.95

Calls 2

startWriteMethod · 0.95
validStreamIDFunction · 0.85

Tested by

no test coverage detected