dougm 01/09/08 11:26:46
Modified:t/response/TestAPI request_rec.pm
todo api.txt
xs/Apache/RequestUtil Apache__RequestUtil.h
xs/maps apache_functions.map apache_structures.map
modperl_functions.map
xs/tables/current/ModPerl FunctionTable.pm
Log:
implement $r->no_cache
Submitted by: Philippe M . Chiasson <[EMAIL PROTECTED]>
Reviewed by: dougm
Revision ChangesPath
1.5 +3 -1 modperl-2.0/t/response/TestAPI/request_rec.pm
Index: request_rec.pm
===
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- request_rec.pm2001/05/04 21:21:44 1.4
+++ request_rec.pm2001/09/08 18:26:46 1.5
@@ -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 || 1;
+
#no_local_copy
ok $r->unparsed_uri;
1.2 +0 -3 modperl-2.0/todo/api.txt
Index: api.txt
===
RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- api.txt 2001/05/08 22:25:57 1.1
+++ api.txt 2001/09/08 18:26:46 1.2
@@ -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
1.6 +23 -0 modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
Index: Apache__RequestUtil.h
===
RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Apache__RequestUtil.h 2001/04/30 04:39:27 1.5
+++ Apache__RequestUtil.h 2001/09/08 18:26:46 1.6
@@ -153,3 +153,26 @@
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; /* XXX */
+int retval = r->no_cache;
+
+if (flag) {
+r->no_cache = (int)SvIV(flag);
+}
+
+if (r->no_cache) {
+apr_table_setn(r->headers_out, "Pragma", "no-cache");
+apr_table_setn(r->headers_out, "Cache-control", "no-cache");
+}
+else if (flag) { /* only unset if $r->no_cache(0) */
+apr_table_unset(r->headers_out, "Pragma");
+apr_table_unset(r->headers_out, "Cache-control");
+}
+
+return retval;
+}
1.28 +1 -0 modperl-2.0/xs/maps/apache_functions.map
Index: apache_functions.map
===
RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- apache_functions.map 2001/08/01 02:06:06 1.27
+++ apache_functions.map 2001/09/08 18:26:46 1.28
@@ -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
1.8 +1 -1 modperl-2.0/xs/maps/apache_structures.map
Index: apache_structures.map
===
RCS file: /home/cvs/modperl-2.0/xs/maps/apache_structures.map,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- apache_structures.map 2001/05/22 20:58:00 1.7
+++ apache_structures.map 2001/09/08 18:26:46 1.8
@@ -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
1.17 +1 -0 modperl-2.0/xs/maps/modperl_functions.map
Index: modperl_functions.map
===
RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- modperl_functions.map 2001/05/08 18:55:55 1.16
+++ modperl_functions.map 2001/09/08 18:26:46 1.17
@@ -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