Skip to content

add http2 version support - #307

Merged
ehsandeep merged 1 commit into
projectdiscovery:mainfrom
0x123456789:main
Apr 2, 2024
Merged

add http2 version support#307
ehsandeep merged 1 commit into
projectdiscovery:mainfrom
0x123456789:main

Conversation

@0x123456789

Copy link
Copy Markdown
Contributor

Hello ProjectDiscovery team, seam like we cant parse HTTP2 request from bytes or string because of version logic. I have the following usecase:

  1. I get this response from Burp:
HTTP/2 200 OKServer: nginx/1.17.9Date: Sat, 30 Mar 2024 17:36:11 GMTContent-Type: application/javascript; charset=utf-8Access-Control-Allow-Origin: *Cache-Control: public, max-age=31556952Etag: W/"af07e301570ab6511cd61c64c4fb822c"Expires: Sun, 30 Mar 2025 23:20:38 GMTLast-Modified: Fri, 15 Mar 2024 13:33:33 GMT

And just want to parse it this way:

typenullWriterReaderstruct {
io.Reader
}
func (nwnullWriterReader) Write(p []byte) (nint, errerror) {
returnlen(p), nil
}
...// data - is gziped Responseifreader, err=gzip.NewReader(bytes.NewReader(data)); err!=nil {
c.JSON(errors.BadRequestError(err))
return
}
rw:=nullWriterReader{reader}
client:=client.NewClient(rw)
res, err:=client.ReadResponse(false)

ReadResponse return error because it doesn't know about HTTP/2 can be without minor version then calling ReadVersion(). My commit should help solve this case

@0x123456789

Copy link
Copy Markdown
ContributorAuthor

I know it's not like "real" HTTP/2 support, but this simple changes allow to read response for example from text file

@Mzack9999Mzack9999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! - The definitive solution would be forking the standard library and removing all validations as done in #112 (unfinished)

@0x123456789

Copy link
Copy Markdown
ContributorAuthor

@Mzack9999 Thank you, can this pull request be merged?

@ehsandeep
ehsandeep merged commit a3d8154 into projectdiscovery:mainApr 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@0x123456789@Mzack9999@ehsandeep