Pascal Bleser 2010-10-12 15:29:05 +00:00 committed by Git OBS Bridge
commit 247c349e3a
7 changed files with 191 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
axel-2.4.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ebc7d40e989c680d2afa632a17e5208101608924cf446da20814a6f3c3338612
size 44995

View File

@ -0,0 +1,11 @@
--- http.c.orig 2010-10-12 16:45:27.000000000 +0200
+++ http.c 2010-10-12 16:47:19.000000000 +0200
@@ -164,7 +164,7 @@
{
i ++;
}
- strncat( conn->headers, s, MAX_QUERY );
+ strncat( conn->headers, s, sizeof(conn->headers) - strlen(conn->headers) - 1 );
}
#ifdef DEBUG

92
axel-getaddrinfo.patch Normal file
View File

@ -0,0 +1,92 @@
--- tcp.c.orig 2010-10-12 16:51:18.000000000 +0200
+++ tcp.c 2010-10-12 17:23:49.000000000 +0200
@@ -25,13 +25,18 @@
#include "axel.h"
+#include <stdio.h>
+
/* Get a TCP connection */
int tcp_connect( char *hostname, int port, char *local_if )
{
- struct hostent *host = NULL;
- struct sockaddr_in addr;
+ struct addrinfo hints;
+ struct addrinfo *ai, *rp;
+ char portbuf[8];
+ snprintf(portbuf, 8, "%d", port);
+
struct sockaddr_in local;
- int fd;
+ int fd = -1;
#ifdef DEBUG
socklen_t i = sizeof( local );
@@ -39,20 +44,34 @@
fprintf( stderr, "tcp_connect( %s, %i ) = ", hostname, port );
#endif
- /* Why this loop? Because the call might return an empty record.
- At least it very rarely does, on my system... */
- for( fd = 0; fd < 5; fd ++ )
- {
- if( ( host = gethostbyname( hostname ) ) == NULL )
- return( -1 );
- if( *host->h_name ) break;
- }
- if( !host || !host->h_name || !*host->h_name )
- return( -1 );
-
- if( ( fd = socket( AF_INET, SOCK_STREAM, 0 ) ) == -1 )
- return( -1 );
-
+ {
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = 0;
+ hints.ai_protocol = 0;
+ if (getaddrinfo(hostname, portbuf, &hints, &ai) != 0)
+ {
+ fd = -1;
+ } else {
+ for (rp = ai; rp != NULL; rp->ai_next)
+ {
+ fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
+ if (fd < 0) continue;
+ if (connect(fd, rp->ai_addr, rp->ai_addrlen) >= 0)
+ {
+ break;
+ }
+ close(fd);
+ }
+ }
+ freeaddrinfo(ai);
+ }
+ if (fd < 0)
+ {
+ return( -1 );
+ }
+
if( local_if && *local_if )
{
local.sin_family = AF_INET;
@@ -64,17 +83,7 @@
return( -1 );
}
}
-
- addr.sin_family = AF_INET;
- addr.sin_port = htons( port );
- addr.sin_addr = *( (struct in_addr *) host->h_addr );
-
- if( connect( fd, (struct sockaddr *) &addr, sizeof( struct sockaddr_in ) ) == -1 )
- {
- close( fd );
- return( -1 );
- }
-
+
#ifdef DEBUG
getsockname( fd, &local, &i );
fprintf( stderr, "%i\n", ntohs( local.sin_port ) );

13
axel.changes Normal file
View File

@ -0,0 +1,13 @@
-------------------------------------------------------------------
Tue Oct 12 15:28:17 UTC 2010 - pascal.bleser@opensuse.org
- copied from home:bitshuffler to network:utilities
- revamped .spec file
- added patch to fix buffer overflow
- added patch to use getaddrinfo instead of gethostbyname
-------------------------------------------------------------------
Fri Jul 3 18:17:47 CEST 2009 - bitshuffler #suse@irc.freenode.org
- Initial RPM

48
axel.spec Normal file
View File

@ -0,0 +1,48 @@
# norootforbuild
Name: axel
Version: 2.4
Release: 0
License: GNU GPL v2
Group: Productivity/Networking/Other
URL: http://axel.alioth.debian.org/
# http://alioth.debian.org/frs/download.php/3015/axel-%{version}.tar.gz
Source: axel-%{version}.tar.bz2
Patch1: axel-fix_buffer_overflow.patch
Patch2: axel-getaddrinfo.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Lightweight Download Accelerator
%description
Axel tries to accelerate HTTP/FTP downloading process by using multiple
connections for one file. It can use multiple mirrors for a download. Axel has
no dependencies and is lightweight, so it might be useful as a wget clone on
byte-critical systems.
%prep
%setup -q
%patch1
%patch2
%build
%configure \
--debug=0 \
--strip=0 \
--i18n=1
%__make %{?_smp_mflags}
%install
%makeinstall
%find_lang axel
%clean
%{?buildroot:%__rm -rf "%{buildroot}"}
%files -f axel.lang
%defattr(-,root,root)
%doc CHANGES
%config %{_sysconfdir}/axelrc
%{_bindir}/axel
%doc %{_mandir}/man1/axel.1%{ext_man}
%lang(zh_CN) %doc %{_mandir}/zh_CN/man1/axel.1%{ext_man}