forked from ports/contrib
btpd: assume maintainership
- added patch to fix bug with BNBT tracker - added man-page
This commit is contained in:
parent
96dd25eebc
commit
cada11e477
@ -3,3 +3,6 @@ drwxr-xr-x root/root usr/bin/
|
||||
-rwxr-xr-x root/root usr/bin/btcli
|
||||
-rwxr-xr-x root/root usr/bin/btinfo
|
||||
-rwxr-xr-x root/root usr/bin/btpd
|
||||
drwxr-xr-x root/root usr/man/
|
||||
drwxr-xr-x root/root usr/man/man1/
|
||||
-rwxr-xr-x root/root usr/man/man1/btpd.1.gz
|
||||
|
@ -1 +1,3 @@
|
||||
65c191672a3a9e57727021fc1ed7be6d btpd-0.13.patch
|
||||
0d9c4a672eea6f298fa6e44d94da1657 btpd-0.13.tar.gz
|
||||
a3293a854e5fe95653fe586970cd934d btpd.1
|
||||
|
21
btpd/Pkgfile
21
btpd/Pkgfile
@ -1,18 +1,19 @@
|
||||
# Description: The BitTorrent Protocol Daemon
|
||||
# Description: BitTorrent client daemon
|
||||
# URL: http://www.murmeldjur.se/btpd/
|
||||
# Maintainer: unmaintained
|
||||
# Packager: James Mills, prologic at shortcircuit dot net dot au
|
||||
# Maintainer: Jürgen Daubert, juergen dot daubert at t-online dot de
|
||||
# Depends on: openssl
|
||||
|
||||
name=btpd
|
||||
version=0.13
|
||||
release=1
|
||||
source=(http://www.murmeldjur.se/$name/$name-$version.tar.gz)
|
||||
release=2
|
||||
source=(http://www.murmeldjur.se/btpd/$name-$version.tar.gz
|
||||
$name-$version.patch $name.1)
|
||||
|
||||
build() {
|
||||
cd $name-$version
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
make DESTDIR=$PKG install
|
||||
chown -R root:root $PKG
|
||||
cd $name-$version
|
||||
patch -p0 -i $SRC/$name-$version.patch
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
make DESTDIR=$PKG install
|
||||
install -D $SRC/btpd.1 $PKG/usr/man/man1/btpd.1
|
||||
}
|
||||
|
115
btpd/btpd-0.13.patch
Normal file
115
btpd/btpd-0.13.patch
Normal file
@ -0,0 +1,115 @@
|
||||
http://lists.stargirl.org/pipermail/btpd-users/2007-June/000250.html
|
||||
|
||||
On Wed, June 27, 2007 10:27, Richard Nyberg said:
|
||||
> On Tue, June 26, 2007 12:29, barone rosso said:
|
||||
>> the tracker is Macnbits, http://beta.macnbits.com/home.php , a BNBT
|
||||
>> tracker based. I have the same problem with all torrents relased by
|
||||
>> this tracker.
|
||||
>>
|
||||
> This tracker almost manages to talk HTTP, but not quite. As specified
|
||||
> in RFC 2616, the line endings in HTTP is encoded with CRLF. This
|
||||
> tracker only sends LF.
|
||||
>
|
||||
> Quoted from http://tools.ietf.org/html/rfc2616 section 3.7.1:
|
||||
> "a bare CR or LF MUST NOT be substituted for CRLF within any of
|
||||
> the HTTP control structures (such as header fields and multipart
|
||||
> boundaries)."
|
||||
>
|
||||
> You should talk to the tracker admins and try to get them to fix it.
|
||||
>
|
||||
> Nevertheless, this is probably a common error - curl deals with it -
|
||||
> so one should perhaps make btpd parse it as well.
|
||||
|
||||
Please try the attached patch. It should tolerate both types of
|
||||
new lines.
|
||||
|
||||
-Richard
|
||||
|
||||
Index: misc/http_client.c
|
||||
===================================================================
|
||||
--- misc/http_client.c (revision 357)
|
||||
+++ misc/http_client.c (working copy)
|
||||
@@ -132,11 +132,24 @@
|
||||
http_free(req);
|
||||
}
|
||||
|
||||
+static char *
|
||||
+strnl(char *str, int *nlsize)
|
||||
+{
|
||||
+ char *nl = strchr(str, '\n');
|
||||
+ if (nl != NULL && nl > str && *(nl - 1) == '\r') {
|
||||
+ *nlsize = 2;
|
||||
+ return nl - 1;
|
||||
+ } else {
|
||||
+ *nlsize = 1;
|
||||
+ return nl;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int
|
||||
headers_parse(struct http_req *req, char *buf, char *end)
|
||||
{
|
||||
- int code, majv, minv;
|
||||
- char *cur, *crlf;
|
||||
+ int code, majv, minv, nlsize;
|
||||
+ char *cur, *nl;
|
||||
char name[128], value[872];
|
||||
struct http_response res;
|
||||
|
||||
@@ -151,12 +164,12 @@
|
||||
if (req->cancel)
|
||||
return 1;
|
||||
|
||||
- cur = strstr(buf, "\r\n") + 2;
|
||||
- crlf = strstr(cur, "\r\n");
|
||||
+ cur = strchr(buf, '\n') + 1;
|
||||
+ nl = strnl(cur, &nlsize);
|
||||
while (cur < end) {
|
||||
int i;
|
||||
char *colon = strchr(cur, ':');
|
||||
- if (colon == NULL || colon > crlf)
|
||||
+ if (colon == NULL || colon > nl)
|
||||
return 0;
|
||||
snprintf(name, sizeof(name), "%.*s", (int)(colon - cur), cur);
|
||||
|
||||
@@ -165,15 +178,15 @@
|
||||
val_loop:
|
||||
while (isblank(*cur))
|
||||
cur++;
|
||||
- while (cur < crlf) {
|
||||
+ while (cur < nl) {
|
||||
if (i < sizeof(value) - 1) {
|
||||
value[i] = *cur;
|
||||
i++;
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
- cur += 2;
|
||||
- crlf = strstr(cur, "\r\n");
|
||||
+ cur += nlsize;
|
||||
+ nl = strnl(cur, &nlsize);
|
||||
if (isblank(*cur)) {
|
||||
if (i < sizeof(value) - 1) {
|
||||
value[i] = ' ';
|
||||
@@ -222,7 +235,11 @@
|
||||
case PS_HEAD:
|
||||
if (len == 0)
|
||||
goto error;
|
||||
- if ((end = evbuffer_find(req->buf, "\r\n\r\n", 4)) == NULL) {
|
||||
+ if ((end = evbuffer_find(req->buf, "\r\n\r\n", 4)) != NULL)
|
||||
+ dlen = 4;
|
||||
+ else if ((end = evbuffer_find(req->buf, "\n\n", 2)) != NULL)
|
||||
+ dlen = 2;
|
||||
+ else {
|
||||
if (req->buf->off < (1 << 15))
|
||||
return 1;
|
||||
else
|
||||
@@ -235,7 +252,7 @@
|
||||
goto error;
|
||||
if (req->cancel)
|
||||
goto cancel;
|
||||
- evbuffer_drain(req->buf, end - (char *)req->buf->buffer + 4);
|
||||
+ evbuffer_drain(req->buf, end - (char *)req->buf->buffer + dlen);
|
||||
goto again;
|
||||
case PS_CHUNK_SIZE:
|
||||
assert(req->chunked);
|
119
btpd/btpd.1
Normal file
119
btpd/btpd.1
Normal file
@ -0,0 +1,119 @@
|
||||
.Dd July 12, 2006
|
||||
.Dt BTPD 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm btpd
|
||||
.Nd BitTorrent protocol daemon
|
||||
.Sh SYNOPSIS
|
||||
.Nm btpd
|
||||
.Op Fl c
|
||||
.Op Fl d Ar dir
|
||||
.Op Fl p Ar port
|
||||
.Op Ar more options ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is the torrent download daemon of this package. Most of the interaction will
|
||||
be with the
|
||||
.Nm btcli
|
||||
tool.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl -bw-in Ar n
|
||||
Limit incoming BitTorrent traffix to
|
||||
.Ar n
|
||||
kB/s. Default is 0 which means unlimited.
|
||||
.It Fl -bw-out Ar n
|
||||
Limit outgoing BitTorrent traffic to
|
||||
.Ar n
|
||||
kB/s. Default is 0 which means unlimited.
|
||||
.It Fl c , Fl -collective-mode
|
||||
Enables collective mode. Collective mode allows the control socket to
|
||||
be written to by all members of the login group
|
||||
.Nm
|
||||
runs as.
|
||||
.Pp
|
||||
.Em WARNING :
|
||||
If enabled, the control socket will have permissions 0640 which mean that ANY
|
||||
user of the login group of the user
|
||||
.Nm
|
||||
is running as can send ANY command to btpd. Use with care.
|
||||
.It Fl d Ar dir
|
||||
The directory in which to run btpd. Default is $HOME/.btpd.
|
||||
.It Fl -help
|
||||
Show the help text.
|
||||
.It Fl -logfile Ar file
|
||||
Where to put the logfile. By default it's put in the btpd dir.
|
||||
.It Fl -max-peers Ar n
|
||||
Limit the amount of peers to
|
||||
.Ar n .
|
||||
.It Fl -max-uploads Ar n
|
||||
Control the number of simultaneous uploads.
|
||||
The possible values are:
|
||||
.Pp
|
||||
.Bl -inset -compact
|
||||
.It Ar n No \&< \-1 :
|
||||
Choose n \&>\&= 2 based on
|
||||
.Fl -bw-out
|
||||
(default).
|
||||
.It Ar n No \&= \-1 :
|
||||
Upload to every interested peer.
|
||||
.It Ar n No \&= \ 0 :
|
||||
Don't upload to anyone.
|
||||
.It Ar n No \&> \ 0 :
|
||||
Upload to at most
|
||||
.Ar n
|
||||
peers simultaneously.
|
||||
.El
|
||||
.It Fl -no-daemon
|
||||
Keep the
|
||||
.Nm
|
||||
process in the foreground and log to std{out, err}.
|
||||
This option is intended for debugging purposes.
|
||||
.It Fl p Ar n , Fl -port Ar n
|
||||
Listen at port
|
||||
.Ar n .
|
||||
Default is 6881.
|
||||
.It Fl -prealloc Ar n
|
||||
Preallocate disk space in chunks of
|
||||
.Ar n
|
||||
kB. Default is 2048. Note that
|
||||
.Ar n
|
||||
will be rounded up to he closest multiple of the torrent piece size. If
|
||||
.Ar n
|
||||
is zero no preallocation will be done.
|
||||
.El
|
||||
.Pp
|
||||
By default,
|
||||
.Nm btpd
|
||||
will store its information and and logfile in $HOME/.btpd. Only one instance
|
||||
of this daemon should be running at a time.
|
||||
.\" There are no references in the code to this but there are in the
|
||||
.\" README. I say: trust the code.
|
||||
.\" .Sh ENVIRONMENT
|
||||
.\" .Bl -tag -width BTPD_HOME
|
||||
.\" .It Ev BTPD_HOME
|
||||
.\" Sets the directory in which to store information and the logfile if
|
||||
.\" present. Overridden by the command-line option.
|
||||
.\" .El
|
||||
.Sh FILES
|
||||
.Bl -tag -width $HOME/.btpd/
|
||||
.It $HOME/.btpd/
|
||||
Default diretory to store information files, the control socket, and the
|
||||
log file.
|
||||
.\" .Sh EXAMPLES
|
||||
.Sh DIAGNOSTICS
|
||||
If the daemon exits quickly for no apparent reason, check the logfile for
|
||||
possible causes. If the logfile indicates something about bind and the adress
|
||||
being in use, check that no other process is using the TCP port 6881
|
||||
(the default) or the one you specified with the -p option.
|
||||
.Sh SEE ALSO
|
||||
.Xr btcli 1 ,
|
||||
.Xr btinfo 1 .
|
||||
.Sh AUTHORS
|
||||
.An Richard Nyberg Aq rnyberg@murmeldjur.se
|
||||
.Sh CAVEATS
|
||||
When using colletive mode, be sure that you trust the members of the login
|
||||
group of the user of
|
||||
.Nm ,
|
||||
otherwise you may end up with nasty suprises.
|
Loading…
x
Reference in New Issue
Block a user