WritePushPromise writes a single PushPromise Frame. As with Header Frames, This is the low level call for writing individual frames. Continuation frames are handled elsewhere. It will perform exactly one Write to the underlying Writer. It is the caller's responsibility to not call other Write meth
(p PushPromiseParam)
| 1398 | // It will perform exactly one Write to the underlying Writer. |
| 1399 | // It is the caller's responsibility to not call other Write methods concurrently. |
| 1400 | func (h2f *Framer) WritePushPromise(p PushPromiseParam) error { |
| 1401 | if !validStreamID(p.StreamID) && !h2f.AllowIllegalWrites { |
| 1402 | return errStreamID |
| 1403 | } |
| 1404 | var flags Flags |
| 1405 | if p.PadLength != 0 { |
| 1406 | flags |= FlagPushPromisePadded |
| 1407 | } |
| 1408 | if p.EndHeaders { |
| 1409 | flags |= FlagPushPromiseEndHeaders |
| 1410 | } |
| 1411 | h2f.startWrite(FramePushPromise, flags, p.StreamID) |
| 1412 | if p.PadLength != 0 { |
| 1413 | h2f.writeByte(p.PadLength) |
| 1414 | } |
| 1415 | if !validStreamID(p.PromiseID) && !h2f.AllowIllegalWrites { |
| 1416 | return errStreamID |
| 1417 | } |
| 1418 | h2f.writeUint32(p.PromiseID) |
| 1419 | h2f.wbuf = append(h2f.wbuf, p.BlockFragment...) |
| 1420 | h2f.wbuf = append(h2f.wbuf, padZeros[:p.PadLength]...) |
| 1421 | return h2f.endWrite() |
| 1422 | } |
| 1423 | |
| 1424 | // WriteRawFrame writes a raw frame. This can be used to write |
| 1425 | // extension frames unknown to this package. |
nothing calls this directly
no test coverage detected