| 604 | -------------------------------------------------------------------------*/ |
| 605 | |
| 606 | int |
| 607 | HTTPHdr::length_get() const |
| 608 | { |
| 609 | int length = 0; |
| 610 | |
| 611 | if (m_http->m_polarity == HTTP_TYPE_REQUEST) { |
| 612 | if (m_http->u.req.m_ptr_method) { |
| 613 | length = m_http->u.req.m_len_method; |
| 614 | } else { |
| 615 | length = 0; |
| 616 | } |
| 617 | |
| 618 | length += 1; // " " |
| 619 | |
| 620 | if (m_http->u.req.m_url_impl) { |
| 621 | length += url_length_get(m_http->u.req.m_url_impl); |
| 622 | } |
| 623 | |
| 624 | length += 1; // " " |
| 625 | |
| 626 | length += 8; // HTTP/%d.%d |
| 627 | |
| 628 | length += 2; // "\r\n" |
| 629 | } else if (m_http->m_polarity == HTTP_TYPE_RESPONSE) { |
| 630 | if (m_http->u.resp.m_ptr_reason) { |
| 631 | length = m_http->u.resp.m_len_reason; |
| 632 | } else { |
| 633 | length = 0; |
| 634 | } |
| 635 | |
| 636 | length += 8; // HTTP/%d.%d |
| 637 | |
| 638 | length += 1; // " " |
| 639 | |
| 640 | length += 3; // status |
| 641 | |
| 642 | length += 1; // " " |
| 643 | |
| 644 | length += 2; // "\r\n" |
| 645 | } |
| 646 | |
| 647 | length += mime_hdr_length_get(m_http->m_fields_impl); |
| 648 | |
| 649 | return length; |
| 650 | } |
| 651 | |
| 652 | /*------------------------------------------------------------------------- |
| 653 | -------------------------------------------------------------------------*/ |