mirror of
https://framagit.org/bortzmeyer/echoping
synced 2024-11-03 03:40:33 +00:00
Error in ICP port name handling. Fixed.
This commit is contained in:
parent
1eb201d4d6
commit
f3e2aaf6e1
11
SRC/AUTHORS
11
SRC/AUTHORS
@ -3,17 +3,20 @@ Stephane Bortzmeyer <bortz@users.sourceforge.net>
|
||||
|
||||
With help from:
|
||||
|
||||
Richard Stevens, author of the book "Unix network programming"
|
||||
W. Richard Stevens, author of the book "Unix network programming"
|
||||
for his book and his many examples (a lot of the code comes from
|
||||
him by copy-and-paste).
|
||||
|
||||
Pierre Beyssac, author of the "bing" tool for examples of code
|
||||
and beta-testing.
|
||||
Pierre Beyssac <pb@fasterix.freenix.org> author of the "bing" tool for
|
||||
examples of code and beta-testing.
|
||||
|
||||
Christian Grimm for the ICP code.
|
||||
Christian Grimm <grimm@rvs.uni-hannover.de> for the ICP code.
|
||||
|
||||
Samuel Tardieu <sam@inf.enst.fr> for the SMTP code.
|
||||
|
||||
Pierre-Yves Lochou <lochou@ilog.fr> for a lot of testing, debugging
|
||||
and porting.
|
||||
|
||||
The Pasteur Institute because the work was done when working on the
|
||||
French national Web cache project, while being an employee of the
|
||||
Institute.
|
||||
|
@ -71,8 +71,9 @@ echoping_LDADD =
|
||||
DOCS = DETAILS
|
||||
|
||||
TESTS = test-echoping-local test-echoping-remote test-echoping-icp
|
||||
MORE_TESTS = test-echoping-crypto
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(TESTS) $(DOCS)
|
||||
EXTRA_DIST = $(man_MANS) $(TESTS) $(DOCS) $(MORE_TESTS)
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
|
@ -128,7 +128,7 @@ AC_TRY_LINK([#include <sys/types.h>
|
||||
|
||||
|
||||
dnl Check the port name for HTTP. Everyone should declare "http" but
|
||||
dnl not everyone does. this test is not perfect, we should use a program
|
||||
dnl not everyone does. This test is BUGgy, we should use a program
|
||||
dnl which calls getservbyname() otherwise we miss NIS tables, for
|
||||
dnl instance.
|
||||
AC_DEFUN([CF_CHECK_SERVICES],
|
||||
|
2
SRC/aclocal.m4
vendored
2
SRC/aclocal.m4
vendored
@ -140,7 +140,7 @@ AC_TRY_LINK([#include <sys/types.h>
|
||||
|
||||
|
||||
dnl Check the port name for HTTP. Everyone should declare "http" but
|
||||
dnl not everyone does. this test is not perfect, we should use a program
|
||||
dnl not everyone does. This test is BUGgy, we should use a program
|
||||
dnl which calls getservbyname() otherwise we miss NIS tables, for
|
||||
dnl instance.
|
||||
AC_DEFUN([CF_CHECK_SERVICES],
|
||||
|
@ -70,7 +70,7 @@
|
||||
/* Port name for HTTP. Unused. */
|
||||
#undef HTTP_TCP_PORT
|
||||
|
||||
/* Port name for ICP */
|
||||
/* Port name for ICP. Unused. */
|
||||
#undef ICP_UDP_PORT
|
||||
|
||||
#undef PACKAGE
|
||||
|
42
SRC/configure
vendored
42
SRC/configure
vendored
@ -2013,48 +2013,6 @@ EOF
|
||||
fi
|
||||
|
||||
|
||||
if test "$ICP" = "1"; then
|
||||
|
||||
echo $ac_n "checking what is the name of the HTTP port in your services database""... $ac_c" 1>&6
|
||||
echo "configure:2020: checking what is the name of the HTTP port in your services database" >&5
|
||||
if grep http /etc/services > /dev/null; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define HTTP_TCP_PORT "http"
|
||||
EOF
|
||||
|
||||
echo "$ac_t""http" 1>&6
|
||||
else
|
||||
if grep www /etc/services > /dev/null; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define HTTP_TCP_PORT "www"
|
||||
EOF
|
||||
|
||||
echo "$ac_t""www" 1>&6
|
||||
else
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define HTTP_TCP_PORT "undefined:use_:80"
|
||||
EOF
|
||||
|
||||
echo "$ac_t""undefined, you should add it in your database" 1>&6
|
||||
fi
|
||||
fi
|
||||
echo $ac_n "checking what is the name of the ICP port in your services database""... $ac_c" 1>&6
|
||||
echo "configure:2043: checking what is the name of the ICP port in your services database" >&5
|
||||
if grep icp /etc/services > /dev/null; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define ICP_UDP_PORT "icp"
|
||||
EOF
|
||||
|
||||
echo "$ac_t""icp" 1>&6
|
||||
else
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define ICP_UDP_PORT "undefined:use_:3130"
|
||||
EOF
|
||||
|
||||
echo "$ac_t""undefined, you should add it in your database" 1>&6
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
trap '' 1 2 15
|
||||
cat > confcache <<\EOF
|
||||
|
@ -95,9 +95,9 @@ AC_ARG_ENABLE(ttcp,
|
||||
AC_DEFINE(HAVE_TTCP)
|
||||
fi)
|
||||
|
||||
if test "$ICP" = "1"; then
|
||||
CF_CHECK_SERVICES
|
||||
fi
|
||||
dnl if test "$ICP" = "1"; then
|
||||
dnl CF_CHECK_SERVICES
|
||||
dnl fi
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
|
@ -151,7 +151,7 @@ main (argc, argv)
|
||||
stop_at_newlines = 0;
|
||||
break;
|
||||
case 'i':
|
||||
port_name = ICP_UDP_PORT;
|
||||
port_name = DEFAULT_ICP_UDP_PORT;
|
||||
port_to_use = USE_ICP;
|
||||
udp = 1;
|
||||
icp = 1;
|
||||
|
@ -95,6 +95,7 @@ struct timeval max_timeval;
|
||||
#define CHARACTER_GENERATOR_TCP_PORT "chargen"
|
||||
#define DEFAULT_HTTP_TCP_PORT "HTTP"
|
||||
#define DEFAULT_HTTPS_TCP_PORT "HTTPS"
|
||||
#define DEFAULT_ICP_UDP_PORT "ICP"
|
||||
/* #define ICP_UDP_PORT "icp" */ /* In config.h */
|
||||
|
||||
#define USE_ECHO 1
|
||||
|
12
SRC/http.c
12
SRC/http.c
@ -69,6 +69,16 @@ find_server_and_port (char *server, short *port, char *default_port)
|
||||
*port = sp->s_port;
|
||||
return;
|
||||
}
|
||||
else if (strcmp (default_port, DEFAULT_ICP_UDP_PORT) == 0)
|
||||
{
|
||||
if ((sp = getservbyname ("icp", "udp")) == NULL)
|
||||
{
|
||||
*port = htons (3130);
|
||||
return;
|
||||
}
|
||||
*port = sp->s_port;
|
||||
return;
|
||||
}
|
||||
else if ((sp = getservbyname (default_port, "tcp")) == NULL)
|
||||
{
|
||||
err_quit ("tcp_open: unknown service: %s/tcp", default_port);
|
||||
@ -128,7 +138,7 @@ read_from_server (CHANNEL fs, short ssl)
|
||||
return -1;
|
||||
if (nr < 2) /* Hmm, if the body is empty, we'll
|
||||
get a meaningless error message */
|
||||
err_sys ("Reading HTTP body");
|
||||
err_sys ("Error reading HTTP body");
|
||||
total = total + nr;
|
||||
return total; /* How to do if we want only the body's size? */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user