joes        2004/07/07 18:56:00

  Modified:    env      test_cgi.c
               src      apreq_env.c
  Log:
  env/test_cgi.c would send the headers before tests 31,32 were able to bake 
their cookies.
  
  Revision  Changes    Path
  1.11      +8 -3      httpd-apreq-2/env/test_cgi.c
  
  Index: test_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/test_cgi.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- test_cgi.c        7 Jul 2004 16:12:15 -0000       1.10
  +++ test_cgi.c        8 Jul 2004 01:56:00 -0000       1.11
  @@ -55,7 +55,6 @@
       apreq_log(APREQ_DEBUG 0, pool, "%s", "Creating apreq_request");
       req = apreq_request(pool, NULL);
   
  -    apr_file_printf(out, "%s", "Content-Type: text/plain\n\n");
       apreq_log(APREQ_DEBUG 0, pool, "%s", "Fetching the parameters");
   
       foo = apreq_param(req, "foo");
  @@ -65,6 +64,8 @@
       key  = apreq_param(req, "key");
   
       if (foo || bar) {
  +        apr_file_printf(out, "%s", "Content-Type: text/plain\n\n");
  +
           if (foo) {
               apr_file_printf(out, "\t%s => %s\n", "foo", foo->v.data);
               apreq_log(APREQ_DEBUG 0, pool, "%s => %s", "foo", foo->v.data);
  @@ -83,19 +84,22 @@
           cookie = apreq_cookie(jar, key->v.data);
   
           if (cookie == NULL) {
  -            apreq_log(APREQ_DEBUG 0, pool, 
  +            apreq_log(APREQ_DEBUG APR_EGENERAL, pool, 
                         "No cookie for %s found!", key->v.data);
               exit(-1);
           }
   
           if (strcmp(test->v.data, "bake") == 0) {
               apreq_cookie_bake(cookie, pool);
  +            apr_file_printf(out, "%s", "Content-Type: text/plain\n\n");
           }
           else if (strcmp(test->v.data, "bake2") == 0) {
               apreq_cookie_bake2(cookie, pool);
  +            apr_file_printf(out, "%s", "Content-Type: text/plain\n\n");
           }
           else {
               char *dest = apr_pcalloc(pool, cookie->v.size + 1);
  +            apr_file_printf(out, "%s", "Content-Type: text/plain\n\n");
               if (apreq_decode(dest, cookie->v.data, cookie->v.size) >= 0)
                   apr_file_printf(out, "%s", dest);
               else {
  @@ -110,6 +114,7 @@
       else { 
           apr_table_t *params = apreq_params(pool, req);
           int count = 0;
  +        apr_file_printf(out, "%s", "Content-Type: text/plain\n\n");
   
           apreq_log(APREQ_DEBUG 0, pool, "Fetching all parameters");
   
  @@ -120,6 +125,6 @@
           apr_table_do(dump_table, &count, params, NULL);
           apr_file_printf(out, "%d", count);
       }
  -    
  +
       return 0;
   }
  
  
  
  1.12      +3 -2      httpd-apreq-2/src/apreq_env.c
  
  Index: apreq_env.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_env.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apreq_env.c       7 Jul 2004 23:53:01 -0000       1.11
  +++ apreq_env.c       8 Jul 2004 01:56:00 -0000       1.12
  @@ -187,9 +187,9 @@
       dP;
       apr_file_t *out;
       int bytes;
  -    apr_file_open_stdout(&out, p);
  +    apr_status_t s = apr_file_open_stdout(&out, p);
  +    apreq_log(APREQ_DEBUG s, p, "Setting header: %s => %s", name, value);
       bytes = apr_file_printf(out, "%s: %s" CRLF, name, value);
  -    apreq_log(APREQ_DEBUG 0, p, "Setting header: %s => %s", name, value);
       return bytes > 0 ? APR_SUCCESS : APR_EGENERAL;
   }
   
  @@ -228,6 +228,7 @@
       apr_file_open_stderr(&err, p);
       apr_file_printf(err, "[%s(%d): %s] %s\n", file, line, 
               apr_strerror(status,buf,255),apr_pvsprintf(p,fmt,vp));
  +    apr_file_flush(err);
   }
   
   static apr_status_t cgi_read(void *env, 
  
  
  

Reply via email to