Skip to content

Commit

Permalink
Merge pull request #5 from h0x0er/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
h0x0er authored Nov 13, 2023
2 parents b789cad + 025907a commit c4f4ef3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) [2023] [h0x0er]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 13 additions & 3 deletions tohttp.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
package http2util

import (
"fmt"
"net/http"

"golang.org/x/net/http2"
)

// Frame2HTTPRequest
func FrameToHTTPRequest(f *http2.MetaHeadersFrame) (*http.Request, error) {
// Frame2HTTPRequest creates http.Request from frame
func FrameToHTTPRequest(frame http2.Frame) (*http.Request, error) {
f, ok := frame.(*http2.MetaHeadersFrame)
if !ok {
return nil, fmt.Errorf("error: only http2.MetaHeadersFrame is supported")
}
return processMetaHeadersForRequest(f)
}

func FrameToHTTPResponse(f *http2.MetaHeadersFrame) (*http.Response, error) {
// FrameToHTTPResponse creates http.Response from frame
func FrameToHTTPResponse(frame http2.Frame) (*http.Response, error) {
f, ok := frame.(*http2.MetaHeadersFrame)
if !ok {
return nil, fmt.Errorf("error: only http2.MetaHeadersFrame is supported")
}
return processMetaHeadersForResponse(f)
}

0 comments on commit c4f4ef3

Please sign in to comment.