apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Blose" <vivaciousm...@gmail.com>
Subject Writing a filter module
Date Tue, 22 Jul 2008 18:01:40 GMT
Hello,

I'm new to writing modules, and I'd greatly appreciate any help. I'm writing
a filter module, but I'm having some trouble with buckets. Right now, I'd
like to be able to see the content inside the buckets for a particular
request, but whenever I try to print it, it is in this strange format that
doesn't even remotely resemble html.

Here is what I see
[Tue Jul 22 09:14:48 2008] [warn] [client 127.0.0.1] str:
<O\xf5\xcc8\xe2$f8\xbc\x80;\x9f=7:\x15\xf3\xec\xfd\x98\x99\x99\xe3\xfe\x82\x939:AOC2\xc7y,\xfbj\xd5\xe8\xa9\x82\x01(\x06\x03\r\x01\x10\xe8&\xf4\xa1]\xc6:\x9e\xb1P-\xf0\xcce\x82yD\xd3\x13oo\xe8!sl\x06('^y\xe2\x86\x86ra\xee\x90,+\x1e\x80_3\x1c|\x898\x83p?\xf1\x06\x82J\xe2\xd3\x04\xd0\x8a\xc1,z1\xec\xff\x96E\x1eb\xa9\xd2\xe1\xc4\x13D^\xd1\x84\xb0\\>{\xea\xea5}\xdaC/\x14u\xcf\xa7f\xeaX\xe2\x19\x84\x1c\x864\x01m\x98!\x96\x87\x02\x12\xc7\xb6\xf0\xd6\r\xab\xdf"\xc3A\xf1{\xc68d\x1cu\xa8d\x80\x10\xae\xbf\xe1
\\\x11U\x9c\xd7\xadl\x12k\x15\x1f\r\x87\x7f\xd6\xf61b\x95P0;\xdc\bb\xf7=\xa4\xed{\xe2Ud\xf8\xc6)\x8a\xd1\x86\x01W\x8c\xc1\x05\x8bi\x88
`K\x9f\xf1N\x8fi\x12!\xc1\x83\x15\x16E?\xa2\xf3J\xbe\x163\xd19\xca\x8e!\xd5\xf8\xc6.\rLf\xe0\x12_\xa6\x1e\xa8\v\xa6\x03\x91\x03\xa9\xed<\xd0\x98\xef\x8a<\xd0\x9f\x07
\x1b=\x10\xd9,\xd2HN<\x9b8\n\xbb\xde\xc7l\xaeC\xe8\x86\xec\xf5\xfd\xf1\x9f=tm\xdd\x03\x1c\xdb+\\E\x85\x85}\xb0\xbd\xcdQ\xa3\xcd\xe2n\xa7\xa5\xba\xfb\x19\x99O\xd2\x99\xc8\xa6\x96\x81u7\xad\xe1\x9cB\x86\xfb\xbc`\t1\x81U\xb9\xbc!\xf6g\xb8R\x92\xbbFta\xb0b\x0c\vJO\x90\x1a\xc1\xc2\x83\x18\xa9T\x02m\xba\x99\xc4;\xfd\xf9\xc3\xfb7\xc7\x03\\\x17lm\xf7M4\xb6+\x85\xa2]\xeb\v{u+\x9a\x97M\x19\xd5/>~x\xfd\xe9\xfc\xea\xf2\xbb\xaa\xaf\xba5\x1c\xc8v\xed\xcf\xcd\xc5m(\x9f`\x1aK6\xd1\xeb\x8d\x7f\xc1afV\xb1\xa1WM\xbc\xd3\xf3\x0f\xbf\\\x9d\x9d_\xa1O\xb7S\x01\xc7*T\x8a@
\xabnsc\x0eBr5#\xafQ\xbf\x04\xf19f\x11k'\xa0\\z\xafQ\xa0\xf5\xdf\x10\xe3\\\xa5\xa9m\x07y]\xe8\xdd\xe5\x1ai\xadNc\xae\xdc\xe6)

And here is the code I use to print thisL

for (b = APR_BRIGADE_FIRST(bb); b!=APR_BRIGADE_SENTINEL(bb); b =
APR_BUCKET_NEXT(b)) {
    const char *buf;
    if (APR_BUCKET_IS_METADATA(b)) {

    } else if (apr_bucket_read(b,&buf,&bytes,APR_BLOCK_READ)==APR_SUCCESS) {
      char* buf1 = apr_palloc(f->r->pool, bytes+1) ;
      memcpy(buf1, buf, bytes) ;
      buf1[bytes] = '\0';
      buf = buf1;
      ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0,f->r,
                     "str: %s",(char*)buf);
    }
  }


I've tried so many things, but I always see this ridiculous crap and I don't
know what I'm doing wrong. I really need to see the html content because I
need to parse it. Can anyone give me any guidance with this?

Thanks,

Todd

Mime
View raw message