From: root Date: Fri, 2 May 2008 06:12:55 +0000 (+0200) Subject: Revert uninentionally patched file X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34dbee795aa884658b1ae0276bf302bb5217adb2;p=sope Revert uninentionally patched file --- diff --git a/sope-appserver/mod_ngobjweb/handler.c b/sope-appserver/mod_ngobjweb/handler.c index b947e00d..b5d30545 100644 --- a/sope-appserver/mod_ngobjweb/handler.c +++ b/sope-appserver/mod_ngobjweb/handler.c @@ -646,10 +646,7 @@ int ngobjweb_handler(request_rec *r) { writeErrorHandler: if (writeError == 1) { - if (toApp) { - NGBufferedDescriptor_free(toApp); - toApp = NULL; - } + if (toApp) NGBufferedDescriptor_free(toApp); ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, "socket write error during transfer of HTTP header section"); @@ -662,10 +659,7 @@ int ngobjweb_handler(request_rec *r) { if (!NGBufferedDescriptor_safeWrite(toApp, requestBody, requestContentLength)) { - if (toApp) { - NGBufferedDescriptor_free(toApp); - toApp = NULL; - } + if (toApp) NGBufferedDescriptor_free(toApp); ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, "couldn't transfer HTTP req body to app server (%i bytes)", contentLength); @@ -683,10 +677,7 @@ int ngobjweb_handler(request_rec *r) { /* read response line */ if (!NGScanResponseLine(toApp, NULL, &statusCode, NULL)) { - if (toApp) { - NGBufferedDescriptor_free(toApp); - toApp = NULL; - } + if (toApp) NGBufferedDescriptor_free(toApp); ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server, "error during reading of response line .."); return 500; @@ -725,8 +716,13 @@ int ngobjweb_handler(request_rec *r) { } // read whole response - NGBufferedDescriptor_safeRead(toApp, buffer, contentLength); + if (!NGBufferedDescriptor_safeRead(toApp, buffer, contentLength)) { + if (toApp != NULL) { NGBufferedDescriptor_free(toApp); toApp = NULL; } + } + // close connection to app + if (toApp != NULL) { NGBufferedDescriptor_free(toApp); toApp = NULL; } + ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, "send response (size=%i)", contentLength); @@ -740,14 +736,15 @@ int ngobjweb_handler(request_rec *r) { int result = 0; int writeCount = 0; - while ((result = NGBufferedDescriptor_read(toApp, - buffer, - sizeof(buffer)) - > 0)) { - ap_rwrite(buffer, result, r); - ap_rflush(r); - writeCount += result; + do { + result = NGBufferedDescriptor_read(toApp, buffer, sizeof(buffer)); + if (result > 0) { + ap_rwrite(buffer, result, r); + ap_rflush(r); + writeCount += result; + } } + while (result > 0); if (HEAVY_LOG && (writeCount > 0)) { ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server, @@ -756,13 +753,7 @@ int ngobjweb_handler(request_rec *r) { } } } - - // close connection to app - if (toApp) { - NGBufferedDescriptor_free(toApp); - toApp = NULL; - } - + return OK; }