Closed L-jasmine closed 5 years ago
in 10.7.1 windows
This issue has been fixed in v.10.7.5
according to doc/CHANGES
:
10.7.5 In getPutPostDeleteUrl(....) sock wasn't closed when returning with webError(..)
Quite correct. Here is the part of the patch related to the lines about which @L-jasmine wrote.
--- ../newlisp-10.7.1/nl-web.c 2017-01-25 11:42:21.000000000 -0500
+++ ./nl-web.c 2019-05-12 12:44:17.000000000 -0400
.
.
.
@@ -527,17 +531,14 @@
/* changed in 10.6.4 should allow 0-length contents and 204 handled earlier */
/* if((haveContentLength == TRUE && fSize == 0) || statusCode == 204) */
if(statusCode == 204)
- {
- return(webError(ERROR_NO_CONTENT));
- resultPtr = NULL;
- }
+ return(webError(ERROR_NO_CONTENT, sock));
.
.
.
@@ -734,10 +735,12 @@
return atol(str);
}
-CELL * webError(int errorNo)
+CELL * webError(int errorNo, int sockno)
{
char msg[64];
+
+if(sockno) close(sockno);
netErrorIdx = errorNo;
snprintf(msg, 64, "ERR: %s", netErrorMsg[errorNo]);
.
.
.
Of course, now all the other error calls are covered too.
$ diff -u ../newlisp-10.7.1/nl-web.c . | grep webError
-CELL * webError(int no);
+CELL * webError(int no, int sockno);
- return(webError(ERROR_FILE_OP));
+ return(webError(ERROR_FILE_OP, sock));
- return(webError(ERROR_FILE_OP));
+ return(webError(ERROR_FILE_OP, sock));
- return(unlink(url) == 0 ? stuffString(OK_FILE_DELETED) : webError(ERROR_FILE_OP));
+ : webError(ERROR_FILE_OP, sock));
- return(webError(ERROR_BAD_URL));
+ return(webError(ERROR_BAD_URL, sock));
- return(webError(ERROR_BAD_URL));
+ return(webError(ERROR_BAD_URL, sock));
- return(webError(ERROR_BAD_URL));
+ return(webError(ERROR_BAD_URL, sock));
- return(webError(netErrorIdx));
+ return(webError(netErrorIdx, sock));
- return(webError(ERROR_TRANSFER));
+ return(webError(ERROR_TRANSFER, sock));
- return(webError(ERROR_TRANSFER));
+ return(webError(ERROR_TRANSFER, sock));
- return(webError(ERR_INET_TIMEOUT));
+ return(webError(ERR_INET_TIMEOUT, sock));
- return(webError(ERROR_INVALID_RESPONSE));
+ return(webError(ERROR_INVALID_RESPONSE, sock));
- return(webError(ERROR_NO_RESPONSE));
+ return(webError(ERROR_NO_RESPONSE, sock));
- return(webError(ERROR_HEADER));
+ return(webError(ERROR_HEADER, sock));
- return(webError(ERROR_NO_CONTENT));
+ return(webError(ERROR_NO_CONTENT, sock));
- return(webError(ERROR_NO_CONTENT));
+ return(webError(ERROR_NO_CONTENT, sock));
- return(webError(ERROR_CHUNKED_FORMAT));
+ return(webError(ERROR_CHUNKED_FORMAT, sock));
- return(webError(ERROR_NO_CONTENT));
+ return(webError(ERROR_NO_CONTENT, sock));
-CELL * webError(int errorNo)
+CELL * webError(int errorNo, int sockno)
Thanks @L-jasmine for reporting this! 10.7.5 should be a nice update. Happy hacking, everyone!
in nl-web.c //532 if(statusCode == 204) { return(webError(ERROR_NO_CONTENT)); resultPtr = NULL; } there return without close socket. so it will use up all tcp port