[OGo-Developer] Bugs in mod_ngobjweb
Wolfgang Sourdeau
developer@opengroupware.org
Fri, 28 Mar 2008 09:28:04 -0400
This is a multi-part message in MIME format.
--------------020406050704050705060603
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
> There are multiple diff formats, I guess you generated a context-diff
> or something like that.
>
> Helge
I have 2.5.9 (from Debian).... And the diff is a simple diff from svn.
But I don't think it poses a problem.
Anyway here is one generated with diff -u...
Wolfgang
--------------020406050704050705060603
Content-Type: text/x-diff;
name="mod_ngobjweb.fixes.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="mod_ngobjweb.fixes.diff"
--- handler.c.old 2008-03-28 09:27:00.000000000 -0400
+++ handler.c 2008-03-28 09:27:02.000000000 -0400
@@ -646,7 +646,10 @@
writeErrorHandler:
if (writeError == 1) {
- if (toApp) NGBufferedDescriptor_free(toApp);
+ if (toApp) {
+ NGBufferedDescriptor_free(toApp);
+ toApp = NULL;
+ }
ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server,
"socket write error during transfer of HTTP header section");
@@ -659,7 +662,10 @@
if (!NGBufferedDescriptor_safeWrite(toApp,
requestBody,
requestContentLength)) {
- if (toApp) NGBufferedDescriptor_free(toApp);
+ if (toApp) {
+ NGBufferedDescriptor_free(toApp);
+ toApp = NULL;
+ }
ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server,
"couldn't transfer HTTP req body to app server (%i bytes)",
contentLength);
@@ -677,7 +683,10 @@
/* read response line */
if (!NGScanResponseLine(toApp, NULL, &statusCode, NULL)) {
- if (toApp) NGBufferedDescriptor_free(toApp);
+ if (toApp) {
+ NGBufferedDescriptor_free(toApp);
+ toApp = NULL;
+ }
ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server,
"error during reading of response line ..");
return 500;
@@ -716,13 +725,8 @@
}
// read whole response
- if (!NGBufferedDescriptor_safeRead(toApp, buffer, contentLength)) {
- if (toApp != NULL) { NGBufferedDescriptor_free(toApp); toApp = NULL; }
- }
+ NGBufferedDescriptor_safeRead(toApp, buffer, contentLength);
- // 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);
@@ -736,15 +740,14 @@
int result = 0;
int writeCount = 0;
- do {
- result = NGBufferedDescriptor_read(toApp, buffer, sizeof(buffer));
- if (result > 0) {
- ap_rwrite(buffer, result, r);
- ap_rflush(r);
- writeCount += result;
- }
+ while ((result = NGBufferedDescriptor_read(toApp,
+ buffer,
+ sizeof(buffer))
+ > 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,
@@ -753,7 +756,13 @@
}
}
}
-
+
+ // close connection to app
+ if (toApp) {
+ NGBufferedDescriptor_free(toApp);
+ toApp = NULL;
+ }
+
return OK;
}
--------------020406050704050705060603--