MCPcopy Create free account
hub / github.com/apache/trafficserver / http_parse_version

Function http_parse_version

src/proxy/hdrs/HTTP.cc:1533–1567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1531 -------------------------------------------------------------------------*/
1532
1533HTTPVersion
1534http_parse_version(const char *start, const char *end)
1535{
1536 int maj;
1537 int min;
1538
1539 if ((end - start) < 8) {
1540 return HTTP_0_9;
1541 }
1542
1543 if ((start[0] == 'H') && (start[1] == 'T') && (start[2] == 'T') && (start[3] == 'P') && (start[4] == '/')) {
1544 start += 5;
1545
1546 maj = 0;
1547 min = 0;
1548
1549 while ((start != end) && isdigit(*start)) {
1550 maj = (maj * 10) + (*start - '0');
1551 start += 1;
1552 }
1553
1554 if (*start == '.') {
1555 start += 1;
1556 }
1557
1558 while ((start != end) && isdigit(*start)) {
1559 min = (min * 10) + (*start - '0');
1560 start += 1;
1561 }
1562
1563 return HTTPVersion(maj, min);
1564 }
1565
1566 return HTTP_0_9;
1567}
1568
1569/*-------------------------------------------------------------------------
1570 -------------------------------------------------------------------------*/

Callers 2

http_parser_parse_reqFunction · 0.85
http_parser_parse_respFunction · 0.85

Calls 1

HTTPVersionClass · 0.85

Tested by

no test coverage detected