LP#1616501: teach mod_perl handlers how to detect client disconnects
[opensrf-equinox.git] / src / perl / lib / OpenSRF.pm
index 801f243..1560cca 100644 (file)
@@ -42,4 +42,21 @@ Returns the scalar value of its caller.
 
 sub class { return scalar(caller); }
 
+=head2 OSRF_APACHE_REQUEST_OBJ
+
+Gets and sets the Apache request object when running inside mod_perl.
+This allows other parts of OpenSRF to investigate the state of the
+remote connection, such as whether the client has disconnected, and
+react accordingly.
+
+=cut
+
+our $_OARO;
+sub OSRF_APACHE_REQUEST_OBJ {
+       my $self = shift;
+       my $a = shift;
+       $_OARO = $a if $a;
+       return $_OARO;
+}
+
 1;