previous fix for this bug introduced new bug
namely, it showed horizontal lines and status messages in non-verbose mode
also, valgrind found an off-by-one allocation error
fixed now
This commit is contained in:
erik%vanderpoel.org 2005-01-19 18:03:44 +00:00
Родитель 804f73a948
Коммит 4666b22381
5 изменённых файлов: 20 добавлений и 8 удалений

Просмотреть файл

@ -272,7 +272,7 @@ getHTTPRequestHeaders(View *view, char *host, char *verbose)
*r++ = str;
viewReport(view, str);
}
fprintf(view->out, "<hr><br>");
viewReportHTML(view, "<hr>");
*r = NULL;
return (unsigned char **) ret;
@ -361,7 +361,7 @@ main(int argc, char *argv[])
);
viewReport(view, "input url:");
viewReport(view, (char *) url);
fprintf(view->out, "<hr><br>");
viewReportHTML(view, "<hr>");
u = urlParse(url);
if
(
@ -412,7 +412,7 @@ main(int argc, char *argv[])
free(newURL);
viewReport(view, "fully qualified url:");
viewReport(view, (char *) u->url);
fprintf(view->out, "<hr><br>");
viewReportHTML(view, "<hr>");
fflush(view->out);
if (!strcmp((char *) u->scheme, "http"))
{

Просмотреть файл

@ -849,7 +849,7 @@ toHTML(unsigned char *str)
result = NULL;
result = calloc(strlen((char *) escaped_str)+2, 1);
result = calloc(strlen((char *) escaped_str)+3, 1);
if (!result)
{
fprintf(stderr, "cannot calloc toHTML string\n");

Просмотреть файл

@ -140,7 +140,7 @@ getSocketAndIPAddress(void *a, unsigned char *hostName, int port,
{
reportTime(REPORT_TIME_GETHOSTBYNAME_FAILURE, &theTime);
reportStatus(a, "gethostbyname_r failed", __FILE__, __LINE__);
fprintf(stdout, "failed<br><hr><br>");
viewReportHTML(a, "failed<br><hr>");
close(sock);
#if !defined(HAVE_GETHOSTBYNAME_R)
threadMutexUnlock();
@ -152,7 +152,7 @@ getSocketAndIPAddress(void *a, unsigned char *hostName, int port,
reportStatus(a, "gethostbyname_r succeeded", __FILE__, __LINE__);
fprintf(stdout, "succeeded<br><hr><br>");
viewReportHTML(a, "succeeded<br><hr>");
memset(addr, 0, sizeof(*addr));
addr->sin_family = host.h_addrtype /* PF_INET */;
@ -278,7 +278,7 @@ netConnect(void *a, unsigned char *hostName, int port)
reportStatus(a, "connect failed", __FILE__, __LINE__);
viewReport(a, "failed:");
viewReport(a, strerror(errno) ? strerror(errno) : "NULL");
fprintf(stdout, "<hr><br>");
viewReportHTML(a, "<hr>");
return -1;
}
@ -286,7 +286,7 @@ netConnect(void *a, unsigned char *hostName, int port)
reportStatus(a, "connect succeeded", __FILE__, __LINE__);
fprintf(stdout, "succeeded<br><hr><br>");
viewReportHTML(a, "succeeded<br><hr>");
threadMutexLock();
connectCount++;

Просмотреть файл

@ -230,6 +230,17 @@ viewReport(View *view, char *str)
}
}
void
viewReportHTML(View *view, char *str)
{
if (verbose)
{
fprintf(view->out, str);
fprintf(view->out, "<br>");
fflush(view->out);
}
}
View *
viewAlloc(void)
{

Просмотреть файл

@ -43,6 +43,7 @@ void viewHTTP(View *view, Input *input);
void viewHTTPHeaderName(View *view, Input *input);
void viewHTTPHeaderValue(View *view, Input *input);
void viewReport(View *view, char *str);
void viewReportHTML(View *view, char *str);
void viewVerbose(void);
#endif /* _VIEW_H_ */