Date: Sun, 14 Dec 2003 03:13:52 +0300 (MSK) From: Nosov Artem <chip-set@mail.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/60216: New port: ftp/prozilla - A download accelerator Message-ID: <20031214001352.5FA88294@void.su> Resent-Message-ID: <200312132320.hBDNK9T4057775@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 60216 >Category: ports >Synopsis: New port: ftp/prozilla - A download accelerator >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Dec 13 15:20:09 PST 2003 >Closed-Date: >Last-Modified: >Originator: Nosov Artem >Release: FreeBSD 4.8-RELEASE i386 >Organization: ASC >Environment: System: FreeBSD 4.8-RELEASE >Description: New port: ftp/prozilla - A downloads accelerator After nine days of working ... seems that is's working ;). Please test it and write some feedback about my implementation of gethostbyname_r() function. Thx. ProZilla is a download accelerator which gives you a 200% to 300% improvement in your file downloading speeds. Features: - Supports FTP - Supports HTTP including redirection - Supports resuming - Complete acceleration: the file will be downloaded as fast as possible as your bandwidth allows - FTP passwords can be specified with the URL, or can be obtained automatically from the .netrc if it exists. - The number of connections that prozilla uses can be specified using the -k option (4 by default). - The bandwidth can be limited using the --max-bps switch or from the config file. - FTPsearch support, to enable this specify the -s option. >How-To-Repeat: >Fix: --- prozilla.shar begins here --- # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # prozilla/ # prozilla/files # prozilla/files/patch-src::ftpsearch.c # prozilla/files/patch-src::misc.c # prozilla/files/patch-src::http-retr.c # prozilla/files/patch-src::ping.c # prozilla/files/patch-src::ftp-retr.c # prozilla/files/patch-src::connection.c # prozilla/files/patch-src::connect.c # prozilla/files/patch-configure.in # prozilla/Makefile # prozilla/distinfo # prozilla/pkg-plist # prozilla/pkg-descr # echo c - prozilla/ mkdir -p prozilla/ > /dev/null 2>&1 echo c - prozilla/files mkdir -p prozilla/files > /dev/null 2>&1 echo x - prozilla/files/patch-src::ftpsearch.c sed 's/^X//' >prozilla/files/patch-src::ftpsearch.c << 'END-of-prozilla/files/patch-src::ftpsearch.c' X--- src/ftpsearch.c.orig Fri Dec 12 23:25:02 2003 X+++ src/ftpsearch.c Fri Dec 12 23:25:33 2003 X@@ -25,6 +25,9 @@ X #include <sys/socket.h> X #include <fcntl.h> X #include <netdb.h> X+#if defined(__FreeBSD__) X+#include <netinet/in_systm.h> X+#endif /* __FreeBSD__ */ X #include <netinet/in.h> X #include <netinet/ip.h> X #include <arpa/inet.h> END-of-prozilla/files/patch-src::ftpsearch.c echo x - prozilla/files/patch-src::misc.c sed 's/^X//' >prozilla/files/patch-src::misc.c << 'END-of-prozilla/files/patch-src::misc.c' X--- src/misc.c.orig Fri Dec 12 23:33:19 2003 X+++ src/misc.c Fri Dec 12 23:33:58 2003 X@@ -24,7 +24,9 @@ X #include <stdio.h> X #include <stdarg.h> X #include <stdlib.h> X+#if !defined(__FreeBSD__) X #include <malloc.h> X+#endif /* !__FreeBSD__ */ X #include <string.h> X #include <ctype.h> X #include <curses.h> END-of-prozilla/files/patch-src::misc.c echo x - prozilla/files/patch-src::http-retr.c sed 's/^X//' >prozilla/files/patch-src::http-retr.c << 'END-of-prozilla/files/patch-src::http-retr.c' X--- src/http-retr.c.orig Fri Dec 12 23:25:48 2003 X+++ src/http-retr.c Fri Dec 12 23:26:14 2003 X@@ -32,6 +32,9 @@ X #include <fcntl.h> X #include <sys/socket.h> X #include <sys/time.h> X+#if defined(__FreeBSD__) X+#include <netinet/in_systm.h> X+#endif /* __FreeBSD__ */ X #include <netinet/in.h> X #include <netinet/ip.h> X #include <netinet/tcp.h> END-of-prozilla/files/patch-src::http-retr.c echo x - prozilla/files/patch-src::ping.c sed 's/^X//' >prozilla/files/patch-src::ping.c << 'END-of-prozilla/files/patch-src::ping.c' X--- src/ping.c.orig Fri Dec 12 23:34:06 2003 X+++ src/ping.c Fri Dec 12 23:34:41 2003 X@@ -23,6 +23,9 @@ X #include <sys/socket.h> X #include <fcntl.h> X #include <netdb.h> X+#if defined(__FreeBSD__) X+#include <netinet/in_systm.h> X+#endif /* __FreeBSD__ */ X #include <netinet/in.h> X #include <netinet/ip.h> X #include <arpa/inet.h> END-of-prozilla/files/patch-src::ping.c echo x - prozilla/files/patch-src::ftp-retr.c sed 's/^X//' >prozilla/files/patch-src::ftp-retr.c << 'END-of-prozilla/files/patch-src::ftp-retr.c' X--- src/ftp-retr.c.orig Fri Dec 12 23:24:04 2003 X+++ src/ftp-retr.c Fri Dec 12 23:24:44 2003 X@@ -32,6 +32,9 @@ X #include <netdb.h> X #include <sys/socket.h> X #include <sys/time.h> X+#if defined(__FreeBSD__) X+#include <netinet/in_systm.h> X+#endif /* __FreeBSD__ */ X #include <netinet/in.h> X #include <netinet/ip.h> X #include <netinet/tcp.h> END-of-prozilla/files/patch-src::ftp-retr.c echo x - prozilla/files/patch-src::connection.c sed 's/^X//' >prozilla/files/patch-src::connection.c << 'END-of-prozilla/files/patch-src::connection.c' X--- src/connection.c.orig Fri Dec 12 23:22:26 2003 X+++ src/connection.c Fri Dec 12 23:23:38 2003 X@@ -30,7 +30,12 @@ X #include <assert.h> X #include <pthread.h> X X+#if defined(__FreeBSD__) X+#include <sys/param.h> X+#include <sys/mount.h> X+#else X #include <sys/vfs.h> X+#endif /* !__FreeBSD__ */ X X #include "connection.h" X #include "misc.h" END-of-prozilla/files/patch-src::connection.c echo x - prozilla/files/patch-src::connect.c sed 's/^X//' >prozilla/files/patch-src::connect.c << 'END-of-prozilla/files/patch-src::connect.c' X--- src/connect.c.orig Fri Dec 12 23:40:31 2003 X+++ src/connect.c Sat Dec 13 00:51:03 2003 X@@ -27,6 +27,9 @@ X #include <sys/socket.h> X #include <fcntl.h> X #include <netdb.h> X+#if defined(__FreeBSD__) X+#include <netinet/in_systm.h> X+#endif /* __FreeBSD__ */ X #include <netinet/in.h> X #include <netinet/ip.h> X #include <netdb.h> X@@ -42,6 +45,116 @@ X #include "runtime.h" X #include "debug.h" X X+#if defined(__FreeBSD__) X+/* X+ * Thread safe implementation of gethostbyname X+ */ X+#include <machine/param.h> X+#include <errno.h> X+#include <netdb.h> X+#include <pthread.h> X+ X+static pthread_mutex_t __hostkey_mutex = PTHREAD_MUTEX_INITIALIZER; X+ X+/* based on bind implementation with cosmetic modifications */ X+static int X+copy_hostent(struct hostent *src, struct hostent *dest, X+ char *buf, size_t buflen) X+{ X+ char *cp; X+ char **ptr; X+ int i, n; X+ size_t nptr, len; X+ X+ /* Find out the amount of space required to store the answer. */ X+ nptr = 2; /* NULL ptrs */ X+ len = (char *) ALIGN(buf) - buf; X+ for (i = 0; src->h_addr_list[i]; i++, nptr++) { X+ len += src->h_length; X+ } X+ for (i = 0; src->h_aliases[i]; i++, nptr++) { X+ len += strlen(src->h_aliases[i]) + 1; X+ } X+ len += strlen(src->h_name) + 1; X+ len += nptr * sizeof(char *); X+ X+ if (len > buflen) { X+ errno = ERANGE; X+ return -1; X+ } X+ X+ /* copy address size and type */ X+ dest->h_addrtype = src->h_addrtype; X+ n = dest->h_length = src->h_length; X+ X+ ptr = (char **)ALIGN(buf); X+ cp = (char *)ALIGN(buf) + nptr * sizeof(char *); X+ X+ /* copy address list */ X+ dest->h_addr_list = ptr; X+ for (i = 0; src->h_addr_list[i]; i++ , ptr++) { X+ memcpy(cp, src->h_addr_list[i], n); X+ dest->h_addr_list[i] = cp; X+ cp += n; X+ } X+ dest->h_addr_list[i] = NULL; X+ ptr++; X+ X+ /* copy official name */ X+ n = strlen(src->h_name) + 1; X+ strcpy(cp, src->h_name); X+ dest->h_name = cp; X+ cp += n; X+ X+ /* copy aliases */ X+ dest->h_aliases = ptr; X+ for (i = 0 ; src->h_aliases[i]; i++) { X+ n = strlen(src->h_aliases[i]) + 1; X+ strcpy(cp, src->h_aliases[i]); X+ dest->h_aliases[i] = cp; X+ cp += n; X+ } X+ dest->h_aliases[i] = NULL; X+ X+ return 0; X+} X+ X+/* X+ * I'am not sure in this gethostbyname_r implemention, but seems X+ * it works fine. If you have some feedback or suggestions please X+ * mail me chip-set@mail.ru X+ */ X+int X+mygethostbyname_r(const char *name, struct hostent *ret, char *buf, X+ size_t buflen, struct hostent **result, int *h_errnop) X+{ X+ struct hostent *hp; X+ int res; X+ X+ pthread_mutex_lock(&__hostkey_mutex); X+ hp = gethostbyname(name); X+ if (NULL == hp) X+ { X+ /* unlocking mutex and store error results */ X+ *h_errnop = h_errno; X+ pthread_mutex_unlock(&__hostkey_mutex); X+ *result = NULL; X+ return -1; X+ } X+ res = copy_hostent(hp, ret, buf, buflen); X+ pthread_mutex_unlock(&__hostkey_mutex); X+ if (res < 0) X+ { X+ *result = NULL; X+ return res; X+ } X+ /* success */ X+ *result = ret; X+ return 0; X+} X+ X+#endif /* __FreeBSD__ */ X+ X uerr_t connect_to_server(int *sock, char *name, int port, int timeout) X { X unsigned int portnum; X@@ -357,6 +470,11 @@ X gethostbyname_r(host,hostbuf,*tmphstbuf,*hstbuflen,&herr))) X && (errno == ERANGE)) X #endif X+#if defined(__FreeBSD__) X+ while ((res = X+ mygethostbyname_r(host, hostbuf, *tmphstbuf, *hstbuflen, &hp, &herr)) X+ && (errno == ERANGE)) X+#endif X { X /* Enlarge the buffer. */ X *hstbuflen *= 2; END-of-prozilla/files/patch-src::connect.c echo x - prozilla/files/patch-configure.in sed 's/^X//' >prozilla/files/patch-configure.in << 'END-of-prozilla/files/patch-configure.in' X--- configure.in.orig Sat Dec 13 00:56:35 2003 X+++ configure.in Sat Dec 13 00:59:02 2003 X@@ -7,6 +7,8 @@ X AC_PROG_CC X AC_PROG_INSTALL X X+AC_CHECK_LIB(gnugetopt, getopt_long,, AC_MSG_ERROR([** The gnugetopt library is not installed.**])) X+ X dnl Replace `main' with a function in -lpthread: X AC_CHECK_LIB(pthread, pthread_create,, AC_MSG_ERROR([** The pthread library is not installed.**])) X X@@ -45,7 +47,7 @@ X AC_FUNC_VPRINTF X AC_CHECK_FUNCS(gettimeofday select socket strdup strerror strstr) X X-AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R X+dnl AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R X X AC_OUTPUT(src/Makefile man/Makefile Makefile) X END-of-prozilla/files/patch-configure.in echo x - prozilla/Makefile sed 's/^X//' >prozilla/Makefile << 'END-of-prozilla/Makefile' X# New ports collection makefile for: prozilla X# Date created: Fri 12 December 2003 X# Whom: Nosov Artem <chip-set@mail.ru> X# X# $FreeBSD$ X# X XPORTNAME= prozilla XPORTVERSION= 1.3.6 XCATEGORIES= ftp www XMASTER_SITES= http://prozilla.genesys.ro/downloads/prozilla/tarballs/ X XMAINTAINER= chip-set@mail.ru XCOMMENT= A download accelerator X XBUILD_DEPENDS= autoconf:${PORTSDIR}/devel/autoconf XLIB_DEPENDS= ncurses.5:${PORTSDIR}/devel/ncurses X XUSE_GETOPT_LONG= yes XUSE_GMAKE= yes XUSE_REINPLACE= yes X XGNU_CONFIGURE= yes XCONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL} XCONFIGURE_ENV= CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include" \ X LIBS="-L${LOCALBASE}/lib" XMAKE_ARGS= ACLOCAL="${TRUE}" AUTOCONF="${TRUE}" AUTOMAKE="${TRUE}" \ X AUTOHEADER="${TRUE}" X XMAN1= prozilla.1 XMLINKS= prozilla.1 proz.1 X Xpre-configure: X @cd ${WRKSRC} && autoconf X @${REINPLACE_CMD} -e \ X 's|-lpthread|${PTHREAD_LIBS}|g' ${WRKSRC}/configure X Xpost-install: X.if !defined(NOPORTDOCS) X @${MKDIR} ${DOCSDIR} X.for file in FAQ README TODO X @${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR} X.endfor X.endif X X.include <bsd.port.mk> END-of-prozilla/Makefile echo x - prozilla/distinfo sed 's/^X//' >prozilla/distinfo << 'END-of-prozilla/distinfo' XMD5 (prozilla-1.3.6.tar.gz) = 65864dfe72f5cb7d7e595ca6f34fc7d7 END-of-prozilla/distinfo echo x - prozilla/pkg-plist sed 's/^X//' >prozilla/pkg-plist << 'END-of-prozilla/pkg-plist' Xbin/proz X@unexec if cmp -s %D/etc/prozilla.conf %D/etc/prozilla.conf-sample; then rm -f %D/etc/prozilla.conf; fi Xetc/prozilla.conf-sample X%%PORTDOCS%%share/doc/prozilla/FAQ X%%PORTDOCS%%share/doc/prozilla/README X%%PORTDOCS%%share/doc/prozilla/TODO X%%PORTDOCS%%@dirrm share/doc/prozilla END-of-prozilla/pkg-plist echo x - prozilla/pkg-descr sed 's/^X//' >prozilla/pkg-descr << 'END-of-prozilla/pkg-descr' XProZilla is a download accelerator which gives you a 200% to 300% Ximprovement in your file downloading speeds. X XFeatures: X- Supports FTP X- Supports HTTP including redirection X- Supports resuming X- Complete acceleration: the file will be downloaded as fast as possible X as your bandwidth allows X- FTP passwords can be specified with the URL, or can be obtained X automatically from the .netrc if it exists. X- The number of connections that prozilla uses can be specified using the -k X option (4 by default). X- The bandwidth can be limited using the --max-bps switch or from the X config file. X- FTPsearch support, to enable this specify the -s option. X X- Nosov Artem Xchip-set@mail.ru END-of-prozilla/pkg-descr exit --- prozilla.shar ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031214001352.5FA88294>