Skip to content

Conversation

@seanmonstar
Copy link
Member

Closes #256

Copy link
Contributor

Choose a reason for hiding this comment

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

This feels a bit low. How about 256?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's better to restrict the total size instead of the count?

Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed other parsers did indeed restrict the total size. I thought that would be complicated, but I just thought of a way.

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to restrict the total size because actually it's possible to consume a lot of memory just by one header, e.g. Cookie.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, that is already checked in read_header.

@seanmonstar
Copy link
Member Author

Updated to count characters instead of headers.

@s-panferov
Copy link
Contributor

👍 Can we make it configurable somehow in the future?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's better to rename it? How about MAX_HEADERS_LENGTH?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

@seanmonstar
Copy link
Member Author

Hm, I guess it could be configurable by passing it as an argument to from_raw...

seanmonstar added a commit that referenced this pull request Feb 4, 2015
fix(headers): add limit to maximum headers that should be parsed
@seanmonstar seanmonstar merged commit eee4625 into master Feb 4, 2015
@seanmonstar seanmonstar deleted the max-headers branch February 4, 2015 02:37
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.

DOS vulnerability by sending a request with many many headers

4 participants