MCPcopy Create free account
hub / github.com/NetSys/bess / is_complete

Function is_complete

core/utils/http_parser.cc:176–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176static const char *is_complete(const char *buf, const char *buf_end,
177 size_t last_len, int *ret) {
178 int ret_cnt = 0;
179 buf = last_len < 3 ? buf : buf + last_len - 3;
180
181 while (1) {
182 CHECK_EOF();
183 if (*buf == '\015') {
184 ++buf;
185 CHECK_EOF();
186 EXPECT_CHAR('\012');
187 ++ret_cnt;
188 } else if (*buf == '\012') {
189 ++buf;
190 ++ret_cnt;
191 } else {
192 ++buf;
193 ret_cnt = 0;
194 }
195 if (ret_cnt == 2) {
196 return buf;
197 }
198 }
199
200 *ret = -2;
201 return NULL;
202}
203
204/* *_buf is always within [buf, buf_end) upon success */
205static const char *parse_int(const char *buf, const char *buf_end, int *value,

Callers 3

phr_parse_requestFunction · 0.85
phr_parse_responseFunction · 0.85
phr_parse_headersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected