Hi, the following patch tries to implement $r->no_cache() ;-)

The only warning I have, is that I had to modify FunctionTable.pm by hand.
I was able to run source_scan.pl and regenerate the tables myself, but the
resulting diff has nothing to do with my change, so here it goes...


-- 
Philippe M. Chiasson  <[EMAIL PROTECTED]>
  Extropia's Resident System Guru
     http://www.eXtropia.com/

When you rewrite a compiler from scratch, you sometimes fix
things you didn't know were broken. 
        -- Larry Wall

perl -e '$$=\${gozer};{$_=unpack(P26,pack(L,$$));/^Just Another Perl 
Hacker!\n$/&&print||$$++&&redo}'
Index: todo/api.txt
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/todo/api.txt,v
retrieving revision 1.1
diff -u -I'$Id' -I'$Revision' -r1.1 api.txt
--- todo/api.txt        2001/05/08 22:25:57     1.1
+++ todo/api.txt        2001/09/08 08:27:05
@@ -18,9 +18,6 @@
 $r->header_{in,out}:
 deprecated, but should be included in Apache::compat
 
-$r->no_cache:
-does not yet manage Pragma, Cache-control headers as 1.x did
-
 $r->pnotes:
 not yet implemented
 
Index: t/response/TestAPI/request_rec.pm
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/t/response/TestAPI/request_rec.pm,v
retrieving revision 1.4
diff -u -I'$Id' -I'$Revision' -r1.4 request_rec.pm
--- t/response/TestAPI/request_rec.pm   2001/05/04 21:21:44     1.4
+++ t/response/TestAPI/request_rec.pm   2001/09/08 08:27:05
@@ -8,7 +8,7 @@
 sub handler {
     my $r = shift;
 
-    plan $r, tests => 36;
+    plan $r, tests => 37;
 
     #Apache->request($r); #PerlOptions +GlobalRequest takes care
     my $gr = Apache->request;
@@ -87,6 +87,8 @@
     #user
 
     #no_cache
+    ok $r->no_cache;
+
     #no_local_copy
 
     ok $r->unparsed_uri;
Index: xs/Apache/RequestUtil/Apache__RequestUtil.h
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
retrieving revision 1.5
diff -u -I'$Id' -I'$Revision' -r1.5 Apache__RequestUtil.h
--- xs/Apache/RequestUtil/Apache__RequestUtil.h 2001/04/30 04:39:27     1.5
+++ xs/Apache/RequestUtil/Apache__RequestUtil.h 2001/09/08 08:27:05
@@ -153,3 +153,23 @@
     auth_value = apr_pstrcat(r->pool, "Basic ", encoded, NULL);
     apr_table_setn(r->headers_in, "Authorization", auth_value);
 }
+
+
+static MP_INLINE
+int mpxs_Apache__RequestRec_no_cache(request_rec *r, SV *flag)
+{
+    dTHX;
+    
+    r->no_cache = (Nullsv == flag || SvTRUE(flag)) ? 1 : 0;
+    
+    if( r->no_cache ) {
+    apr_table_setn(r->headers_out,"Pragma","no-cache");
+    apr_table_setn(r->headers_out,"Cache-control", "no-cache");
+    } 
+    else {
+    apr_table_unset(r->headers_out,"Pragma");
+    apr_table_unset(r->headers_out,"Cache-control");
+    }
+
+    return r->no_cache;
+}
Index: xs/maps/apache_functions.map
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/xs/maps/apache_functions.map,v
retrieving revision 1.27
diff -u -I'$Id' -I'$Revision' -r1.27 apache_functions.map
--- xs/maps/apache_functions.map        2001/08/01 02:06:06     1.27
+++ xs/maps/apache_functions.map        2001/09/08 08:27:05
@@ -43,6 +43,7 @@
 !ap_content_type_tolower
  ap_get_status_line
  ap_is_initial_req
+ mpxs_Apache__RequestRec_no_cache
 
 #MODULE=Apache::RequestConfig
  ap_document_root
Index: xs/maps/apache_structures.map
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/xs/maps/apache_structures.map,v
retrieving revision 1.7
diff -u -I'$Id' -I'$Revision' -r1.7 apache_structures.map
--- xs/maps/apache_structures.map       2001/05/22 20:58:00     1.7
+++ xs/maps/apache_structures.map       2001/09/08 08:27:05
@@ -49,7 +49,7 @@
 >  vlist_validator
    user
 -  ap_auth_type #should use ap_auth_type function instead
-   no_cache
+~  no_cache
    no_local_copy
    unparsed_uri
    uri
Index: xs/maps/modperl_functions.map
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/xs/maps/modperl_functions.map,v
retrieving revision 1.16
diff -u -I'$Id' -I'$Revision' -r1.16 modperl_functions.map
--- xs/maps/modperl_functions.map       2001/05/08 18:55:55     1.16
+++ xs/maps/modperl_functions.map       2001/09/08 08:27:05
@@ -8,6 +8,7 @@
  #protocol module helpers
  mpxs_Apache__RequestRec_location_merge
  mpxs_Apache__RequestRec_set_basic_credentials
+ mpxs_Apache__RequestRec_no_cache | | r, flag=Nullsv
 PACKAGE=Apache::RequestRec
  mpxs_Apache__RequestRec_new | | classname, c, base_pool=NULL
 PACKAGE=Apache
Index: xs/tables/current/ModPerl/FunctionTable.pm
===================================================================
RCS file: /home/anoncvs/mod_perl-2-cvs/xs/tables/current/ModPerl/FunctionTable.pm,v
retrieving revision 1.22
diff -u -I'$Id' -I'$Revision' -r1.22 FunctionTable.pm
--- xs/tables/current/ModPerl/FunctionTable.pm  2001/09/06 05:16:25     1.22
+++ xs/tables/current/ModPerl/FunctionTable.pm  2001/09/08 08:27:05
@@ -4040,6 +4040,20 @@
         'name' => 'block'
       }
     ]
+  },
+    {
+    'return_type' => 'int',
+    'name' => 'mpxs_Apache__RequestRec_no_cache',
+    'args' => [
+      {
+        'type' => 'request_rec *',
+        'name' => 'r'
+      },
+      {
+        'type' => 'SV *',
+        'name' => 'flag'
+      }
+    ]
   }
 ];
 

PGP signature

Reply via email to