-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi group!

For mod_auth_openpgp I need to read the POST body. During my research 
(googling, archives of this
list, apache.org, etc) I discovered three methods so far. I would like your 
opinions on the safest
one, fastest one, if should DECHUNK, how much to allow for post size allocation 
(probably a
configuration option, but i'd need a default value...).

This is what I got: anything you can think of would be of GREAT help:

Getting REQUEST BODY: (1)
============================

        ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
        
        char buffer[1024];

        if ( ap_should_client_block(r) == 1 ) {
                while ( ap_get_client_block(r, buffer, 1024) > 0 ) {
                        ap_rputs("Reading in buffer...<br>",r);
                        ap_rputs(buffer,r);
                }
        } else {
                ap_rputs("Nothing to read...<br>",r);
        }

Getting REQUEST BODY: (2)
============================

http://httpd.apache.org/apreq/

Getting REQUEST BODY: (3)
============================
static int util_read(request_rec *r, const char **rbuf)
{
   int rc;

    if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)) != OK) {
       return rc;
   }

    if (ap_should_client_block(r)) {
       char argsbuffer[HUGE_STRING_LEN];
      int rsize, len_read, rpos=0;
      long length = r->remaining;
      *rbuf = ap_pcalloc(r->pool, length + 1);

       ap_hard_timeout("util_read", r);

       while ((len_read =
               ap_get_client_block(r, argsbuffer, sizeof(argsbuffer))) > 0) {
          ap_reset_timeout(r);
          if ((rpos + len_read) > length) {
              rsize = length - rpos;
          }
          else {
              rsize = len_read;
          }
          memcpy((char*)*rbuf + rpos, argsbuffer, rsize);
          rpos += rsize;
      }

       ap_kill_timeout(r);
    }
   return rc;
}

- --
Arturo "Buanzo" Busleiman - Consultor Independiente en Seguridad Informatica
Foros GNU/Buanzo: Respeto, Soluciones y Buena Onda: http://foros.buanzo.com.ar
Consulting and Secure Mail Hosting: http://www.buanzo.com.ar/pro/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGHmb3AlpOsGhXcE0RClVRAJ95UqidCJcSXqmdWMGupuNahdBk/QCfb5KO
R5y+G2NbAFGUIvHYytfHxb4=
=xxOM
-----END PGP SIGNATURE-----

Reply via email to