http2util

package module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 15 Imported by: 0

README

http2util: Dump rawBytes of http2 frames to string, http.Request or http.Response

Usage

import "github.com/h0x0er/http2util"

rawBytes := []byte{} // http2 frame bytes

// Creating frame out of rawBytes
frame, _ := http2util.BytesToFrame(rawBytes)

// Usage 1: Dumping frame to string
frameString, _ := http2util.Dump(frame)
fmt.Println(frameString)

// Usage2: Creating http.Request from frame
req, _ = http2util.FrameToHTTPRequest(frame)

// Usage3: Creating http.Response from frame
res, _ = http2util.FrameToHTTPReponse(frame)

Limitations

  • FrameToHTTPRequest() & FrameToHTTPResponse(): Currently doesn't supports extraction of httpBody from frame.

Contribution

Feel free to open an issue or send a PR for improvement

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToFrame

func BytesToFrame(b []byte) (http2.Frame, error)

func Dump

func Dump(f http2.Frame) (string, error)

func DumpMetaHeaders

func DumpMetaHeaders(f *http2.MetaHeadersFrame) (string, error)

DumpMetaHeaders

func FrameToHTTPRequest

func FrameToHTTPRequest(frame http2.Frame) (*http.Request, error)

Frame2HTTPRequest creates http.Request from frame

func FrameToHTTPResponse

func FrameToHTTPResponse(frame http2.Frame) (*http.Response, error)

FrameToHTTPResponse creates http.Response from frame

func GetFrameType

func GetFrameType(f http2.Frame) http2.FrameType

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL