diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-06-30 09:52:39 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-06-30 09:52:39 +0000 |
| commit | e36a3de0f458a9267f4d4907e78e706400b7a18c (patch) | |
| tree | 2802fa3d5bf59eed3e07368764a18904b11f05ab /src/HttpConnection.h | |
| parent | 50b4cf67e04f4253891c53c1b1b97168fdc1aa76 (diff) | |
2007-06-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made -S option work with metalink file and provided selective
download
to metalink.
* src/MetalinkEntry.h, src/MetalinkEntry.cc
(filename): Removed.
(file): New variable.
(size): Removed.
(operator=): Updated.
(getPath): New function.
(getLength): New function.
(toFileEntry): New function.
* src/TorrentRequestInfo.h, src/TorrentRequestInfo.cc
(execute): Use toStream.
(showFileEntry): Removed.
* src/MetalinkRequestInfo.h
(targetFiles): New variable.
(setTargetFiles): New variable.
* src/MetalinkRequestInfo.cc
(execute): Added the ability to print file information included
in
a metalink file.
Added selective download mode to metalink.
* src/main.cc
(showUsage): Updated to denote that -S and --select-file options
are
applicable to metalink.
* src/FileEntry.h
(operator=): New function.
(getBasename): New function.
(getDirname): New function.
* src/Util.h, src/Util.cc
(toStream): New function.
* src/Xml2MetalinkProcessor.cc: Updated.
Made aria2 work with metalink with directory structure.
* src/File.h, src/File.cc
(getBasename): New function.
(getDirname): New function.
* src/RequestGroup.h, src/RequestGroup.cc
(_topDir): New variable.
(setTopDir): New function.
(initSegmentMan): A directory structure is added to
_segmentMan->dir.
Rewrote HTTP header parsing with stringstream.
* src/HttpConnection.h, src/HttpConnection.cc
(HttpRequestEntry): New class.
(headerBuf): Removed.
(headerBufLength): Removed.
(outstandingHttpRequests): Now its element type is
HttpRequestEntryHandle.
(findEndOfHeader): Removed.
(receiveResponse): Rewritten.
Updated doc for -j option to notice that it should be used with
-i
option.
* src/main.cc (showUsage)
Removed unused classes.
* src/RequestInfo.h
(FileInfo): Removed.
(checksum): Removed.
(fileInfo): Removed.
(setChecksum): Removed.
(getChecksum): Removed.
(getFileInfo): Removed.
Use ISO units.
* src/ConsoleDownloadEngine.cc
* src/TorrentConsoleDownloadEngine.cc
* src/Util.cc (abbrevSize)
Diffstat (limited to 'src/HttpConnection.h')
| -rw-r--r-- | src/HttpConnection.h | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/HttpConnection.h b/src/HttpConnection.h index 61c4ee87..96ab0f77 100644 --- a/src/HttpConnection.h +++ b/src/HttpConnection.h @@ -43,10 +43,35 @@ #include "common.h" #include "Logger.h" #include "HttpResponse.h" +#include "HttpHeaderProcessor.h" #include <netinet/in.h> #include <string> -#define HEADERBUF_SIZE 4096 +class HttpRequestEntry { +private: + HttpRequestHandle _httpRequest; + HttpHeaderProcessorHandle _proc; +public: + HttpRequestEntry(const HttpRequestHandle& httpRequest, + const HttpHeaderProcessorHandle& proc): + _httpRequest(httpRequest), + _proc(proc) {} + + ~HttpRequestEntry() {} + + HttpRequestHandle getHttpRequest() const + { + return _httpRequest; + } + + HttpHeaderProcessorHandle getHttpHeaderProcessor() const + { + return _proc; + } +}; + +typedef SharedHandle<HttpRequestEntry> HttpRequestEntryHandle; +typedef deque<HttpRequestEntryHandle> HttpRequestEntries; class HttpConnection { private: @@ -54,12 +79,9 @@ private: SocketHandle socket; const Option* option; const Logger* logger; - char headerBuf[HEADERBUF_SIZE+1]; - int headerBufLength; - HttpRequests outstandingHttpRequests; + HttpRequestEntries outstandingHttpRequests; - int findEndOfHeader(const char* buf, const char* substr, int bufLength) const; string eraseConfidentialInfo(const string& request); public: HttpConnection(int cuid, @@ -96,7 +118,7 @@ public: HttpRequestHandle getFirstHttpRequest() const { if(outstandingHttpRequests.size() > 0) { - return outstandingHttpRequests.front(); + return outstandingHttpRequests.front()->getHttpRequest(); } else { return 0; } |
