Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix http: request body too large err #378

Merged
merged 2 commits into from Mar 27, 2024
Merged

Conversation

dogancanbakir
Copy link
Member

Closes #377

test:

func TestResponseChain_Fill(t *testing.T) {
	resp, err := http.Get("https://download.binance.com/electron-desktop/mac/production/binance.dmg")
	require.Nil(t, err)
	require.NotNil(t, resp)

	rc := NewResponseChain(resp, int64(4<<20))
	err = rc.Fill()
	require.Nil(t, err)

	headers := rc.Headers().String()
	body := rc.Body().String()
	fullResponse := rc.FullResponse().String()

	require.Contains(t, headers, "application/x-apple-diskimage")
	require.Contains(t, fullResponse, headers)
	require.NotEmpty(t, body)
}

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

lgtm - In general, within nuclei, I think that we should probably push into the direction to set a large maximum body size to avoid infinite reading, and at the same time opt for cold storage buffer for large bodies (ex disk backed bytes.Buffer)

@dogancanbakir dogancanbakir merged commit 0581372 into main Mar 27, 2024
7 checks passed
@dogancanbakir dogancanbakir deleted the fix_body_too_large_err branch March 27, 2024 14:54
Sign up for free to 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.

ResponseChain.Fill() returns http: request body too large when reading large data
2 participants