dougm 01/11/06 11:09:14
Modified: xs/Apache/RequestIO Apache__RequestIO.h
Log:
move ap_{setup,should}_client_block wrappers into
modperl_{setup,should}_client_block so they can be called elsewhere
Revision Changes Path
1.19 +24 -9 modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h
Index: Apache__RequestIO.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Apache__RequestIO.h 2001/11/06 18:41:46 1.18
+++ Apache__RequestIO.h 2001/11/06 19:09:14 1.19
@@ -135,6 +135,27 @@
return nrd;
}
+static MP_INLINE
+apr_status_t modperl_setup_client_block(request_rec *r)
+{
+ if (!r->read_length) {
+ apr_status_t rc;
+
+ /* only do this once per-request */
+ if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)) != OK) {
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0,
+ r->server,
+ "mod_perl: ap_setup_client_block failed: %d", rc);
+ return rc;
+ }
+ }
+
+ return APR_SUCCESS;
+}
+
+#define modperl_should_client_block(r) \
+ (r->read_length || ap_should_client_block(r))
+
/* alias */
#define mpxs_Apache__RequestRec_READ mpxs_Apache__RequestRec_read
@@ -146,17 +167,11 @@
long nrd = 0;
int rc;
- if (!r->read_length) {
- /* only do this once per-request */
- if ((rc = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)) != OK) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0,
- r->server,
- "mod_perl: ap_setup_client_block failed: %d", rc);
- return 0;
- }
+ if ((rc = modperl_setup_client_block(r)) != APR_SUCCESS) {
+ return 0;
}
- if (r->read_length || ap_should_client_block(r)) {
+ if (modperl_should_client_block(r)) {
/* ap_should_client_block() will return 0 if r->read_length */
mpxs_sv_grow(buffer, bufsiz+offset);
nrd = ap_get_client_block(r, SvPVX(buffer)+offset, bufsiz);