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

Strict UTF-8 validation fast fail #9

Closed
zaphoyd opened this issue Sep 15, 2011 · 2 comments
Closed

Strict UTF-8 validation fast fail #9

zaphoyd opened this issue Sep 15, 2011 · 2 comments
Labels

Comments

@zaphoyd
Copy link
Owner

zaphoyd commented Sep 15, 2011

Presently UTF8 validation is done on a per frame basis. A frame is read and then checked. True fast UTF8 fail would fail as soon as the first bad byte was read. Doing this would require a different setup for reading from ASIO so it will be low priority for now. THis might need to be done in the future anyways, in particular if a streaming api is ever needed.

@zaphoyd
Copy link
Owner Author

zaphoyd commented Apr 13, 2012

This has been implemented for a bit. websocketpp::DEFAULT_READ_THRESHOLD controls the size of the read/validation batches. Smaller values catch UTF8 errors sooner but involve more ASIO overhead. 1 = fail on first byte, 512 is a pretty good default. Note: a value of <10 is required to pass the AB fast fail test as of version 0.5.0. This may change in the future as values this small are inefficient.

@zaphoyd zaphoyd closed this as completed Apr 13, 2012
@zaphoyd
Copy link
Owner Author

zaphoyd commented Apr 13, 2012

also, endpoint::set_read_threshold(size_t) can be used to set that value at runtime for all future connections, connection::set_read_threshold(size_t) can set it for an individual connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant