r248 - in /apt-transport-debtorrent/trunk: debtorrent.cc debtorrent.h
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Wed Aug 15 03:12:56 UTC 2007
Author: camrdale-guest
Date: Wed Aug 15 03:12:55 2007
New Revision: 248
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=248
Log:
Rename the protocol from HTTP to DEBTORRENT.
Modified:
apt-transport-debtorrent/trunk/debtorrent.cc
apt-transport-debtorrent/trunk/debtorrent.h
Modified: apt-transport-debtorrent/trunk/debtorrent.cc
URL: http://svn.debian.org/wsvn/debtorrent/apt-transport-debtorrent/trunk/debtorrent.cc?rev=248&op=diff
==============================================================================
--- apt-transport-debtorrent/trunk/debtorrent.cc (original)
+++ apt-transport-debtorrent/trunk/debtorrent.cc Wed Aug 15 03:12:55 2007
@@ -3,7 +3,23 @@
// $Id: http.cc,v 1.59 2004/05/08 19:42:35 mdz Exp $
/* ######################################################################
- HTTP Acquire Method - This is the HTTP aquire method for APT.
+ DEBTORRENT Acquire Method - This is the DEBTORRENT aquire method for APT.
+
+ It is originally based on APT's HTTP Acquire Method (version 0.7.6).
+
+ The DEBTORRENT protocol is almost identical to HTTP/1.1, with
+ modifications to allow for extra pipelining of requests and the
+ returning of files in a different order than requested.
+
+ The pipelining change removes the limit on the number of outstanding
+ requests that are allowed so that all requests received from APT are
+ immediately requested from the DebTorrent client.
+
+ To return files in a different order than requested, the request name
+ must be used in the header line of the response. For example, if a
+ request line is "GET /what/temp.html DEBTORRENT/1.1", and the HTTP/1.1
+ response would be "HTTP/1.1 200 OK", then the DebTorrent response is
+ "DEBTORRENT/1.1 /what/temp/html 200 OK".
It uses HTTP/1.1 and many of the fancy options there-in, such as
pipelining, range, if-range and so on.
@@ -503,30 +519,30 @@
string Tag = string(Line,0,Pos);
string Val = string(Line,Pos2);
- if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0)
+ if (stringcasecmp(Tag.c_str(),Tag.c_str()+10,"DEBTORRENT") == 0)
{
// Evil servers return no version
- if (Line[4] == '/')
- {
- if (sscanf(Line.c_str(),"HTTP/%u.%u %u %[^\n]",&Major,&Minor,
+ if (Line[10] == '/')
+ {
+ if (sscanf(Line.c_str(),"DEBTORRENT/%u.%u %u %[^\n]",&Major,&Minor,
&Result,Code) != 4)
return _error->Error(_("The HTTP server sent an invalid reply header"));
}
else
{
Major = 0;
- Minor = 9;
- if (sscanf(Line.c_str(),"HTTP %u %[^\n]",&Result,Code) != 2)
+ Minor = 1;
+ if (sscanf(Line.c_str(),"DEBTORRENT %u %[^\n]",&Result,Code) != 2)
return _error->Error(_("The HTTP server sent an invalid reply header"));
}
/* Check the HTTP response header to get the default persistance
state. */
- if (Major < 1)
+ if (Major < 0)
Persistent = false;
else
{
- if (Major == 1 && Minor <= 0)
+ if (Major == 0 && Minor <= 0)
Persistent = false;
else
Persistent = true;
@@ -618,7 +634,7 @@
/* Build the request. We include a keep-alive header to tweak old
http/1.0 servers that do support keep-alive but not HTTP/1.1
automatic keep-alive. */
- sprintf(Buf,"GET %s HTTP/1.1\r\nHost: %s\r\nConnection: keep-alive\r\n",
+ sprintf(Buf,"GET %s DEBTORRENT/0.1\r\nHost: %s\r\nConnection: keep-alive\r\n",
QuoteString(Uri.Path,"~").c_str(),ProperHost.c_str());
string Req = Buf;
@@ -645,7 +661,7 @@
Req += string("Authorization: Basic ") +
Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
- Req += "User-Agent: Debian APT-HTTP/1.3 ("VERSION")\r\n\r\n";
+ Req += "User-Agent: Debian APT-DEBTORRENT/0.1 ("VERSION")\r\n\r\n";
if (Debug == true)
cerr << Req << endl;
Modified: apt-transport-debtorrent/trunk/debtorrent.h
URL: http://svn.debian.org/wsvn/debtorrent/apt-transport-debtorrent/trunk/debtorrent.h?rev=248&op=diff
==============================================================================
--- apt-transport-debtorrent/trunk/debtorrent.h (original)
+++ apt-transport-debtorrent/trunk/debtorrent.h Wed Aug 15 03:12:55 2007
@@ -3,7 +3,7 @@
// $Id: http.h,v 1.12 2002/04/18 05:09:38 jgg Exp $
/* ######################################################################
- HTTP Acquire Method - This is the HTTP aquire method for APT.
+ DEBTORRENT Acquire Method - This is the DEBTORRENT aquire method for APT.
##################################################################### */
/*}}}*/
More information about the Debtorrent-commits
mailing list