mirror of https://github.com/aria2/aria2
2008-04-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Now auto protocol detection is enabled without -Z option. But there is a important difference between with/without -Z optoin. For example, if you type: aria2c http://host/file file1.torrent file2.metalink http://mirror/file then, aria2 interprets there are 3 request groups: (1) http://host/file, http://mirror/file <-- multi-source download (2) file1.torrent (3) file2.metalink On the other hand, if you invoke above command with -Z option, it is interpreted as 4 request groups: (1) http://host/file (2) file1.torrent (3) file2.metalink (4) http://mirror/file I think usually user don't mix multi-source URLs and torrent files, so there is no big problem here. * src/main.ccpull/1/head
parent
8678e1f380
commit
a7952cce05
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2008-04-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Now auto protocol detection is enabled without -Z option.
|
||||||
|
But there is a important difference between with/without -Z optoin.
|
||||||
|
|
||||||
|
For example, if you type:
|
||||||
|
aria2c http://host/file file1.torrent file2.metalink http://mirror/file
|
||||||
|
then, aria2 interprets there are 3 request groups:
|
||||||
|
(1) http://host/file, http://mirror/file <-- multi-source download
|
||||||
|
(2) file1.torrent
|
||||||
|
(3) file2.metalink
|
||||||
|
|
||||||
|
On the other hand, if you invoke above command with -Z option, it is
|
||||||
|
interpreted as 4 request groups:
|
||||||
|
(1) http://host/file
|
||||||
|
(2) file1.torrent
|
||||||
|
(3) file2.metalink
|
||||||
|
(4) http://mirror/file
|
||||||
|
|
||||||
|
I think usually user don't mix multi-source URLs and torrent files, so
|
||||||
|
there is no big problem here.
|
||||||
|
* src/main.cc
|
||||||
|
|
||||||
2008-04-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-04-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Fixed the bug that causes segmentaion fault when reading XML containing
|
Fixed the bug that causes segmentaion fault when reading XML containing
|
||||||
|
|
26
src/main.cc
26
src/main.cc
|
@ -293,6 +293,15 @@ int32_t downloadUriList(Option* op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class StreamProtocolFilter {
|
||||||
|
private:
|
||||||
|
ProtocolDetector _detector;
|
||||||
|
public:
|
||||||
|
bool operator()(const std::string& uri) {
|
||||||
|
return _detector.isStreamProtocol(uri);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
int32_t downloadUri(Option* op, const std::deque<std::string>& uris)
|
int32_t downloadUri(Option* op, const std::deque<std::string>& uris)
|
||||||
{
|
{
|
||||||
std::deque<std::string> nargs;
|
std::deque<std::string> nargs;
|
||||||
|
@ -307,11 +316,22 @@ int32_t downloadUri(Option* op, const std::deque<std::string>& uris)
|
||||||
std::deque<SharedHandle<RequestGroup> >(),
|
std::deque<SharedHandle<RequestGroup> >(),
|
||||||
AccRequestGroup(op));
|
AccRequestGroup(op));
|
||||||
} else {
|
} else {
|
||||||
|
std::deque<std::string>::iterator strmProtoEnd =
|
||||||
|
std::stable_partition(nargs.begin(), nargs.end(), StreamProtocolFilter());
|
||||||
|
// let's process http/ftp protocols first.
|
||||||
std::deque<std::string> xargs;
|
std::deque<std::string> xargs;
|
||||||
ncopy(nargs.begin(), nargs.end(), op->getAsInt(PREF_SPLIT),
|
ncopy(nargs.begin(), strmProtoEnd, op->getAsInt(PREF_SPLIT),
|
||||||
std::back_inserter(xargs));
|
std::back_inserter(xargs));
|
||||||
RequestGroupHandle rg = createRequestGroup(op, xargs, op->get(PREF_OUT));
|
if(xargs.size()) {
|
||||||
groups.push_back(rg);
|
RequestGroupHandle rg = createRequestGroup(op, xargs, op->get(PREF_OUT));
|
||||||
|
groups.push_back(rg);
|
||||||
|
}
|
||||||
|
// process remaining URIs(local metalink, BitTorrent files)
|
||||||
|
std::deque<SharedHandle<RequestGroup> > remGroups =
|
||||||
|
std::accumulate(strmProtoEnd, nargs.end(),
|
||||||
|
std::deque<SharedHandle<RequestGroup> >(),
|
||||||
|
AccRequestGroup(op));
|
||||||
|
groups.insert(groups.end(), remGroups.begin(), remGroups.end());
|
||||||
}
|
}
|
||||||
return MultiUrlRequestInfo(groups, op, getStatCalc(op), getSummaryOut(op)).execute();
|
return MultiUrlRequestInfo(groups, op, getStatCalc(op), getSummaryOut(op)).execute();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue