Skip to content

Fix exception that occurs with libc++ regex engine

Compare
Choose a tag to compare
@yhirose yhirose released this 01 Mar 18:29
· 1032 commits to master since this release
bf7700d
Fix exception that occurs with libc++ regex engine (#368)

The regex that parses header lines potentially causes an unlimited
amount of backtracking, which can cause an exception in the libc++ regex
engine.

The exception that occurs looks like this and is identical to the
message of the exception fixed in
https://github.com/yhirose/cpp-httplib/pull/280:

	libc++abi.dylib: terminating with uncaught exception of type
	std::__1::regex_error: The complexity of an attempted match
	against a regular expression exceeded a pre-set level.

This commit eliminates the problematic backtracking.