HttpParser: Change Execute() to return StringRef (#1209)

This is more user-friendly than returning the number of parsed bytes.
This commit is contained in:
Peter Johnson
2018-07-22 15:07:22 -07:00
committed by GitHub
parent 74a306d47a
commit 31ced30c1e

View File

@@ -48,10 +48,11 @@ class HttpParser {
/**
* Executes the parser. An empty input is treated as EOF.
* @param in input data
* @return Number of parsed bytes.
* @return Trailing input data after the parse.
*/
size_t Execute(StringRef in) {
return http_parser_execute(&m_parser, &m_settings, in.data(), in.size());
StringRef Execute(StringRef in) {
return in.drop_front(
http_parser_execute(&m_parser, &m_settings, in.data(), in.size()));
}
/**