httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-test/perl-framework/t/protocol nntp-like.t
Date Wed, 29 Sep 2004 06:53:42 GMT
jerenkrantz    2004/09/28 23:53:42

  Modified:    perl-framework/c-modules/nntp_like mod_nntp_like.c
               perl-framework/t/apache contentlength.t
               perl-framework/t/protocol nntp-like.t
  Log:
  Fix up nntp-like and content-length tests to pass.
  
  * c-modules/nntp_like/mod_nntp_like.c: Add pre_connection hook so that the
    timeout on the socket is set.  (NET_TIME which normally does this is a
    request filter); Minor style changes thrown in for good measure.
  * t/protocol/nntp-like.t: Was t_cmp argument order swapped?  The debugging
    output makes no sense and leads me to believe they are reversed.
  * t/apache/contentlength.t: Sending a blank C-L *should* generate a 413
    (not sure what I was thinking initially why a 200 is correct); flip t_cmp
    arguments and give a more descriptive error message.
  
  Revision  Changes    Path
  1.7       +12 -3     httpd-test/perl-framework/c-modules/nntp_like/mod_nntp_like.c
  
  Index: mod_nntp_like.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/c-modules/nntp_like/mod_nntp_like.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -u -r1.6 -r1.7
  --- mod_nntp_like.c	15 Jun 2004 20:20:23 -0000	1.6
  +++ mod_nntp_like.c	29 Sep 2004 06:53:42 -0000	1.7
  @@ -99,6 +99,12 @@
       return ap_pass_brigade(c->output_filters, bb);
   }
   
  +static int nntp_like_pre_connection(conn_rec *c, void *csd)
  +{
  +    apr_socket_timeout_set(csd, c->base_server->keep_alive_timeout);
  +    return DECLINED;
  +}
  +
   static int nntp_like_process_connection(conn_rec *c)
   {
       apr_bucket_brigade *bb;
  @@ -110,7 +116,7 @@
       if (!cfg->enabled) {
           return DECLINED;
       }
  -    
  +
       /* handshake if talking over SSL */
       if ((rv = nntp_like_init_connection(c)) != APR_SUCCESS) {
           return rv;
  @@ -123,7 +129,7 @@
   
       do {
           bb = apr_brigade_create(c->pool, c->bucket_alloc);
  -        
  +
           if ((rv = ap_get_brigade(c->input_filters, bb,
                                    AP_MODE_GETLINE,
                                    APR_BLOCK_READ, 0) != APR_SUCCESS || 
  @@ -134,7 +140,8 @@
           }
   
           APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_flush_create(c->bucket_alloc));
  -        rv = ap_pass_brigade(c->output_filters, bb);    
  +
  +        rv = ap_pass_brigade(c->output_filters, bb);
       } while (rv == APR_SUCCESS);
   
       return OK;
  @@ -142,6 +149,8 @@
   
   static void nntp_like_register_hooks(apr_pool_t *p)
   {
  +    ap_hook_pre_connection(nntp_like_pre_connection, NULL, NULL,
  +                           APR_HOOK_MIDDLE);
       ap_hook_process_connection(nntp_like_process_connection,
                                  NULL, NULL,
                                  APR_HOOK_MIDDLE);
  
  
  
  1.4       +4 -3      httpd-test/perl-framework/t/apache/contentlength.t
  
  Index: contentlength.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/apache/contentlength.t,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- contentlength.t	31 Jan 2004 00:25:46 -0000	1.3
  +++ contentlength.t	29 Sep 2004 06:53:42 -0000	1.4
  @@ -15,8 +15,8 @@
                       "/i_do_not_exist_in_your_wildest_imagination");
   
   # This is expanded out.
  -my @resp_strings = ("HTTP/1.1 200 OK",
  -                    "HTTP/1.1 404 Not Found",
  +my @resp_strings = ("HTTP/1.1 413 Request Entity Too Large",
  +                    "HTTP/1.1 413 Request Entity Too Large",
                       "HTTP/1.1 200 OK",
                       "HTTP/1.1 404 Not Found",
                       "HTTP/1.1 200 OK",
  @@ -51,7 +51,8 @@
       # Read the status line
       chomp(my $response = Apache::TestRequest::getline($sock) || '');
       $response =~ s/\s$//;
  -    ok t_cmp($resp_strings[$cycle++], $response, "response codes");
  +    ok t_cmp($response, $resp_strings[$cycle++],
  +             "response codes POST for $request_uri with Content-Length: $data");
   
       do {
           chomp($response = Apache::TestRequest::getline($sock) || '');
  
  
  
  1.4       +2 -2      httpd-test/perl-framework/t/protocol/nntp-like.t
  
  Index: nntp-like.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/protocol/nntp-like.t,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- nntp-like.t	7 Aug 2004 02:15:51 -0000	1.3
  +++ nntp-like.t	29 Sep 2004 06:53:42 -0000	1.4
  @@ -30,7 +30,7 @@
       my $response = Apache::TestRequest::getline($sock);
   
       $response =~ s/[\r\n]+$//;
  -    ok t_cmp('200 localhost - ready', $response,
  +    ok t_cmp($response, '200 localhost - ready',
                'welcome response');
   
       for my $data ('LIST', 'GROUP dev.httpd.apache.org', 'ARTICLE 401') {
  @@ -38,6 +38,6 @@
   
           $response = Apache::TestRequest::getline($sock);
           chomp($response) if (defined($response));
  -        ok t_cmp($data, $response, 'echo');
  +        ok t_cmp($response, $data, 'echo');
       }
   }
  
  
  

Mime
View raw message