MCPcopy Create free account
hub / github.com/apache/brpc / ParseFromArray

Method ParseFromArray

src/brpc/details/http_message.cpp:460–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460ssize_t HttpMessage::ParseFromArray(const char *data, const size_t length) {
461 if (Completed()) {
462 if (length == 0) {
463 return 0;
464 }
465 LOG(ERROR) << "Append data(len=" << length
466 << ") to already-completed message";
467 return -1;
468 }
469 const size_t nprocessed =
470 http_parser_execute(&_parser, &g_parser_settings, data, length);
471 if (_parser.http_errno != 0) {
472 // May try HTTP on other formats, failure is norm.
473 RPC_VLOG << "Fail to parse http message, parser=" << _parser
474 << ", buf=`" << butil::StringPiece(data, length) << '\'';
475 return -1;
476 }
477 _parsed_length += nprocessed;
478 return nprocessed;
479}
480
481ssize_t HttpMessage::ParseFromIOBuf(const butil::IOBuf &buf) {
482 if (Completed()) {

Callers 6

TESTFunction · 0.80
LLVMFuzzerTestOneInputFunction · 0.80
RemoveSpansBeforeMethod · 0.80
FindSpansFunction · 0.80
ListSpansFunction · 0.80
ParseHttpMessageFunction · 0.80

Calls 1

http_parser_executeFunction · 0.85

Tested by 1

TESTFunction · 0.64