}
rc = ajp_msg_peek_uint8(*msg, &result);
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
- "ajp_read_header: ajp_ilink_received 0x%02x", result);
+ "ajp_read_header: ajp_ilink_received %s (0x%02x)",
+ ajp_type_str(result), result);
return APR_SUCCESS;
}
apr_byte_t result;
ajp_msg_peek_uint8(msg, &result);
ap_log_error(APLOG_MARK, APLOG_TRACE6, 0, r->server,
- "ajp_parse_type: got 0x%02x", result);
+ "ajp_parse_type: got %s (0x%02x)",
+ ajp_type_str(result), result);
return (int) result;
}
}
if (result != CMD_AJP13_SEND_HEADERS) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
- "ajp_parse_headers: wrong type 0x%02x expecting 0x%02x",
- result, CMD_AJP13_SEND_HEADERS);
+ "ajp_parse_headers: wrong type %s (0x%02x) expecting %s (0x%02x)",
+ ajp_type_str(result), result,
+ ajp_type_str(CMD_AJP13_SEND_HEADERS), CMD_AJP13_SEND_HEADERS);
return AJP_EBAD_HEADER;
}
return ajp_unmarshal_response(msg, r, conf);
}
if (result != CMD_AJP13_SEND_BODY_CHUNK) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
- "ajp_parse_data: wrong type 0x%02x expecting 0x%02x",
- result, CMD_AJP13_SEND_BODY_CHUNK);
+ "ajp_parse_data: wrong type %s (0x%02x) expecting %s (0x%02x)",
+ ajp_type_str(result), result,
+ ajp_type_str(CMD_AJP13_SEND_BODY_CHUNK), CMD_AJP13_SEND_BODY_CHUNK);
return AJP_EBAD_HEADER;
}
rc = ajp_msg_get_uint16(msg, len);
}
if (result != CMD_AJP13_END_RESPONSE) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
- "ajp_parse_reuse: wrong type 0x%02x expecting 0x%02x",
- result, CMD_AJP13_END_RESPONSE);
+ "ajp_parse_reuse: wrong type %s (0x%02x) expecting %s (0x%02x)",
+ ajp_type_str(result), result,
+ ajp_type_str(CMD_AJP13_END_RESPONSE), CMD_AJP13_END_RESPONSE);
return AJP_EBAD_HEADER;
}
return ajp_msg_get_uint8(msg, reuse);
"ajp_handle_cping_cpong: Done");
return rv;
}
+
+
+#define case_to_str(x) case CMD_AJP13_##x:\
+ return #x;\
+ break;
+
+/**ยท
+ * Convert numeric message type into string
+ * @param type AJP message type
+ * @return AJP message type as a string
+ */
+const char *ajp_type_str(int type)
+{
+ switch (type) {
+ case_to_str(FORWARD_REQUEST)
+ case_to_str(SEND_BODY_CHUNK)
+ case_to_str(SEND_HEADERS)
+ case_to_str(END_RESPONSE)
+ case_to_str(GET_BODY_CHUNK)
+ case_to_str(SHUTDOWN)
+ case_to_str(PING)
+ case_to_str(CPONG)
+ case_to_str(CPING)
+ default:
+ return "CMD_AJP13_UNKNOWN";
+ }
+
+}