costin 02/05/14 10:15:27 Modified: jk/native2/common jk_msg_ajp.c Log: Long due - 'decent' dump of the buffer. Lots of pointers, it'll probably disqualify me as a java programmer. Revision Changes Path 1.13 +57 -22 jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c Index: jk_msg_ajp.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_msg_ajp.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- jk_msg_ajp.c 8 May 2002 23:55:11 -0000 1.12 +++ jk_msg_ajp.c 14 May 2002 17:15:27 -0000 1.13 @@ -55,13 +55,16 @@ * * * ========================================================================= */ -/*************************************************************************** - * Description: Data marshaling. XDR like * - * Author: Costin Manolache - * Author: Gal Shachor <[EMAIL PROTECTED]> * - * Author: Henri Gomez <[EMAIL PROTECTED]> * - * Version: $Revision: 1.12 $ * - ***************************************************************************/ +/** + * Data marshaling. Originally based on Jserv's ajp12 and other similar + * formats. Implements the jk_msg interface. + * + * Will be eventually replaced with XDR or CDR. + * + * @author: Gal Shachor <[EMAIL PROTECTED]> + * @author: Henri Gomez <[EMAIL PROTECTED]> + * @author: Costin Manolache + */ #include "jk_pool.h" #include "jk_msg.h" @@ -70,33 +73,65 @@ #include "jk_channel.h" #include "jk_requtil.h" +/* Signature for the messages sent from Apache to tomcat + */ #define AJP13_WS_HEADER 0x1234 +/* Size of the header ( signature + len ) + */ #define AJP_HEADER_LEN (4) #define AJP_HEADER_SZ_LEN (2) +char *jk_HEX="0123456789ABCDEFX"; + /* - * Simple marshaling code. + * Debugging - display the buffer. */ static void jk2_msg_ajp_dump(jk_env_t *env, struct jk_msg *_this, char *err) { - int i=0; + unsigned int i=0; + char line[80]; + char *current; + unsigned int j; + unsigned int len=_this->len; + + if( len > 1024 ) len=1024; + env->l->jkLog( env, env->l, JK_LOG_INFO, "%s pos=%d len=%d max=%d \n", err, _this->pos, _this->len, _this->maxlen ); - - env->l->jkLog( env, env->l, JK_LOG_INFO, - "%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x \n", - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++], - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++], - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++], - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++]); - env->l->jkLog( env, env->l, JK_LOG_INFO, - "%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x:%2x %2x %2x %2x \n", - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++], - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++], - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++], - _this->buf[i++],_this->buf[i++],_this->buf[i++],_this->buf[i++]); + + for( i=0; i< len; i+=16) { + current=line; +/* I can't believe I did this ! That's the %.4x :-) + *current++= jk_HEX[ ( i & 0xf000 ) >> 12 ]; */ +/* *current++= jk_HEX[ ( i & 0x0f00 ) >> 8 ]; */ +/* *current++= jk_HEX[ ( i & 0xf0 ) >> 4 ]; */ +/* *current++= jk_HEX[ ( i & 0x0f ) ]; */ + + for( j=0; j<16; j++ ) { + unsigned char x=(_this->buf[i+j]); + + *current++ = jk_HEX[x >> 4 ]; + *current++ = jk_HEX[x & 0x0f ]; + *current++ =' '; + } + *current++=' '; + *current++='-'; + *current++=' '; + for( j=0; j<16; j++ ) { + unsigned char x=_this->buf[i+j]; + + if( x > 0x20 && x < 0x7F ) { + *current++=x; + } else { + *current++='.'; + } + } + *current++='\n'; + *current++='\0'; + fprintf( stderr, "%.4x %s", i, line ); + } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>