示例#1
0
文件: handler.go 项目: Jxck/speedy
func pushData(data string, framer *spdy.Framer, frame *spdy.SynStreamFrame) error {
	dataFrame := spdy.DataFrame{
		StreamId: frame.StreamId + 1,
		Flags:    spdy.DataFlagFin,
		Data:     []byte(data),
	}

	err := framer.WriteFrame(&dataFrame)
	if err != nil {
		return err
	}
	debug("push %v", &dataFrame)
	return nil
}
示例#2
0
文件: handler.go 项目: Jxck/speedy
func sendSynReply(header http.Header, framer *spdy.Framer, frame *spdy.SynStreamFrame) error {

	synReply := spdy.SynReplyFrame{
		CFHeader: spdy.ControlFrameHeader{}, // Flag is 0x00
		StreamId: frame.StreamId,
		Headers:  header,
	}

	err := framer.WriteFrame(&synReply)
	if err != nil {
		return err
	}
	debug("send %v", &synReply)
	return nil
}
示例#3
0
文件: handler.go 项目: Jxck/speedy
func sendSynStream(header http.Header, framer *spdy.Framer, frame *spdy.SynStreamFrame) error {
	synStreamFrame := spdy.SynStreamFrame{
		CFHeader: spdy.ControlFrameHeader{
			Flags: spdy.ControlFlagUnidirectional,
		},
		StreamId:             frame.StreamId + 1,
		Headers:              header,
		AssociatedToStreamId: frame.StreamId,
	}

	err := framer.WriteFrame(&synStreamFrame)
	if err != nil {
		return err
	}

	debug("push %v", &synStreamFrame)
	return nil
}