* Read the ajp message and return the type of the message. */
| 723 | * Read the ajp message and return the type of the message. |
| 724 | */ |
| 725 | apr_status_t ajp_read_header(apr_socket_t *sock, |
| 726 | request_rec *r, |
| 727 | apr_size_t buffsize, |
| 728 | ajp_msg_t **msg) |
| 729 | { |
| 730 | apr_byte_t result; |
| 731 | apr_status_t rc; |
| 732 | |
| 733 | if (*msg) { |
| 734 | rc = ajp_msg_reuse(*msg); |
| 735 | if (rc != APR_SUCCESS) { |
| 736 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00990) |
| 737 | "ajp_read_header: ajp_msg_reuse failed"); |
| 738 | return rc; |
| 739 | } |
| 740 | } |
| 741 | else { |
| 742 | rc = ajp_msg_create(r->pool, buffsize, msg); |
| 743 | if (rc != APR_SUCCESS) { |
| 744 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00991) |
| 745 | "ajp_read_header: ajp_msg_create failed"); |
| 746 | return rc; |
| 747 | } |
| 748 | } |
| 749 | ajp_msg_reset(*msg); |
| 750 | rc = ajp_ilink_receive(sock, *msg); |
| 751 | if (rc != APR_SUCCESS) { |
| 752 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00992) |
| 753 | "ajp_read_header: ajp_ilink_receive failed"); |
| 754 | return rc; |
| 755 | } |
| 756 | ajp_msg_log(r, *msg, "ajp_read_header: ajp_ilink_receive packet dump"); |
| 757 | rc = ajp_msg_peek_uint8(*msg, &result); |
| 758 | if (rc != APR_SUCCESS) { |
| 759 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00993) |
| 760 | "ajp_read_header: ajp_msg_peek_uint8 failed"); |
| 761 | return rc; |
| 762 | } |
| 763 | ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, |
| 764 | "ajp_read_header: ajp_ilink_received %s (0x%02x)", |
| 765 | ajp_type_str(result), result); |
| 766 | return APR_SUCCESS; |
| 767 | } |
| 768 | |
| 769 | /* parse the msg to read the type */ |
| 770 | int ajp_parse_type(request_rec *r, ajp_msg_t *msg) |
no test coverage detected