Mercurial > hg > nginx
comparison src/http/ngx_http_parse.c @ 4125:e5df04b05e75
Protocol version parsing in ngx_http_parse_status_line().
Once we know protocol version, set u->headers_in.connection_close to indicate
implicitly assumed connection close with HTTP before 1.1.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 15 Sep 2011 19:22:35 +0000 |
parents | ac33852faaac |
children | e7db97bfac25 |
comparison
equal
deleted
inserted
replaced
4124:0c30976f5bfa | 4125:e5df04b05e75 |
---|---|
1401 case sw_first_major_digit: | 1401 case sw_first_major_digit: |
1402 if (ch < '1' || ch > '9') { | 1402 if (ch < '1' || ch > '9') { |
1403 return NGX_ERROR; | 1403 return NGX_ERROR; |
1404 } | 1404 } |
1405 | 1405 |
1406 r->http_major = ch - '0'; | |
1406 state = sw_major_digit; | 1407 state = sw_major_digit; |
1407 break; | 1408 break; |
1408 | 1409 |
1409 /* the major HTTP version or dot */ | 1410 /* the major HTTP version or dot */ |
1410 case sw_major_digit: | 1411 case sw_major_digit: |
1415 | 1416 |
1416 if (ch < '0' || ch > '9') { | 1417 if (ch < '0' || ch > '9') { |
1417 return NGX_ERROR; | 1418 return NGX_ERROR; |
1418 } | 1419 } |
1419 | 1420 |
1421 r->http_major = r->http_major * 10 + ch - '0'; | |
1420 break; | 1422 break; |
1421 | 1423 |
1422 /* the first digit of minor HTTP version */ | 1424 /* the first digit of minor HTTP version */ |
1423 case sw_first_minor_digit: | 1425 case sw_first_minor_digit: |
1424 if (ch < '0' || ch > '9') { | 1426 if (ch < '0' || ch > '9') { |
1425 return NGX_ERROR; | 1427 return NGX_ERROR; |
1426 } | 1428 } |
1427 | 1429 |
1430 r->http_minor = ch - '0'; | |
1428 state = sw_minor_digit; | 1431 state = sw_minor_digit; |
1429 break; | 1432 break; |
1430 | 1433 |
1431 /* the minor HTTP version or the end of the request line */ | 1434 /* the minor HTTP version or the end of the request line */ |
1432 case sw_minor_digit: | 1435 case sw_minor_digit: |
1437 | 1440 |
1438 if (ch < '0' || ch > '9') { | 1441 if (ch < '0' || ch > '9') { |
1439 return NGX_ERROR; | 1442 return NGX_ERROR; |
1440 } | 1443 } |
1441 | 1444 |
1445 r->http_minor = r->http_minor * 10 + ch - '0'; | |
1442 break; | 1446 break; |
1443 | 1447 |
1444 /* HTTP status code */ | 1448 /* HTTP status code */ |
1445 case sw_status: | 1449 case sw_status: |
1446 if (ch == ' ') { | 1450 if (ch == ' ') { |
1514 | 1518 |
1515 if (status->end == NULL) { | 1519 if (status->end == NULL) { |
1516 status->end = p; | 1520 status->end = p; |
1517 } | 1521 } |
1518 | 1522 |
1523 status->http_version = r->http_major * 1000 + r->http_minor; | |
1519 r->state = sw_start; | 1524 r->state = sw_start; |
1520 | 1525 |
1521 return NGX_OK; | 1526 return NGX_OK; |
1522 } | 1527 } |
1523 | 1528 |