httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: httpd-test/perl-framework/c-modules/eat_post .cvsignore mod_eat_post.c
Date Thu, 17 Jan 2002 00:17:36 GMT
dougm       02/01/16 16:17:36

  Added:       perl-framework/c-modules/eat_post .cvsignore mod_eat_post.c
  Log:
  module for testing large POSTs, similar to mod_echo_post.c, but does not
  echo back the data read (since too large will flood the socket), instead
  just writes the number of bytes read.
  
  Revision  Changes    Path
  1.1                  httpd-test/perl-framework/c-modules/eat_post/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  Makefile
  .libs
  mod_eat_post.lo
  mod_eat_post.slo
  mod_eat_post.la
  
  
  
  1.1                  httpd-test/perl-framework/c-modules/eat_post/mod_eat_post.c
  
  Index: mod_eat_post.c
  ===================================================================
  #if CONFIG_FOR_HTTPD_TEST
  
  <Location /eat_post>
     SetHandler eat_post
  </Location>
  
  #endif
  
  #define APACHE_HTTPD_TEST_HANDLER eat_post_handler
  
  #include "apache_httpd_test.h"
  
  /* like mod_echo_post.c but does not echo back the data,
   * just sends back the number of bytes read
   */
  static int eat_post_handler(request_rec *r)
  {
      int rc;
      long nrd, total = 0;
      char buff[AP_IOBUFSIZE];
  
      if (strcmp(r->handler, "eat_post")) {
          return DECLINED;
      }
      if (r->method_number != M_POST) {
          return DECLINED;
      }
  
      if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)) != OK) {
          ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO,
  #ifdef APACHE2
                       0,
  #endif /* APACHE2 */
                       r->server,
                       "[mod_eat_post] ap_setup_client_block failed: %d", rc);
          return rc;
      }
  
      if (!ap_should_client_block(r)) {
          return OK;
      }
  
  #ifdef APACHE1
      ap_send_http_header(r);
  #endif
      
      while ((nrd = ap_get_client_block(r, buff, sizeof(buff))) > 0) {
          total += nrd;
      }
  
      ap_rprintf(r, "%ld\n", total);
      
      return OK;
  }
  
  APACHE_HTTPD_TEST_MODULE(eat_post);
  
  
  

Mime
View raw message