MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / test_header_overflow_error

Function test_header_overflow_error

libs/qhttpserver/http-parser/test.c:3168–3194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3166}
3167
3168void
3169test_header_overflow_error (int req)
3170{
3171 http_parser parser;
3172 http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3173 size_t parsed;
3174 const char *buf;
3175 buf = req ? "GET / HTTP/1.1\r\n" : "HTTP/1.0 200 OK\r\n";
3176 parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3177 assert(parsed == strlen(buf));
3178
3179 buf = "header-key: header-value\r\n";
3180 size_t buflen = strlen(buf);
3181
3182 int i;
3183 for (i = 0; i < 10000; i++) {
3184 parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
3185 if (parsed != buflen) {
3186 //fprintf(stderr, "error found on iter %d\n", i);
3187 assert(HTTP_PARSER_ERRNO(&parser) == HPE_HEADER_OVERFLOW);
3188 return;
3189 }
3190 }
3191
3192 fprintf(stderr, "\n*** Error expected but none in header overflow test ***\n");
3193 abort();
3194}
3195
3196
3197void

Callers 1

mainFunction · 0.85

Calls 2

http_parser_initFunction · 0.85
http_parser_executeFunction · 0.85

Tested by

no test coverage detected