URI uri = Queue->Uri;
+ FetchResult Res;
+
+ uint8_t data[10240];
+ size_t offset = 0;
+
Status("Connecting to %s", uri.Host.c_str());
if (!CFReadStreamOpen(rs)) {
+ _error->Error("Unable to open stream");
Fail(true);
- continue;
+ goto done;
}
- uint8_t data[10240];
CFIndex rd = CFReadStreamRead(rs, data, sizeof(data));
- FetchResult Res;
+ if (rd == -1) {
+ _error->Error("Stream read failure");
+ Fail(true);
+ goto done;
+ }
+
Res.Filename = Queue->DestFile;
hm = (CFHTTPMessageRef) CFReadStreamCopyProperty(rs, kCFStreamPropertyHTTPResponseHeader);
UInt32 sc = CFHTTPMessageGetResponseStatusCode(hm);
- size_t offset = 0;
-
sr = CFHTTPMessageCopyHeaderFieldValue(hm, CFSTR("Content-Range"));
if (sr != NULL) {
size_t ln = CFStringGetLength(sr) + 1;
URIStart(Res);
- read: if (rd == -1)
+ read: if (rd == -1) {
+ _error->Error("Stream read failure");
Fail(true);
- else if (rd == 0) {
+ } else if (rd == 0) {
if (Res.Size == 0)
Res.Size = File->Size();
URI uri = Queue->Uri;
+ FetchResult Res;
+
+ uint8_t data[10240];
+ size_t offset = 0;
+
Status("Connecting to %s", uri.Host.c_str());
if (!CFReadStreamOpen(rs)) {
+ _error->Error("Unable to open stream");
Fail(true);
- continue;
+ goto done;
}
- uint8_t data[10240];
CFIndex rd = CFReadStreamRead(rs, data, sizeof(data));
- FetchResult Res;
+ if (rd == -1) {
+ _error->Error("Stream read failure");
+ Fail(true);
+ goto done;
+ }
+
Res.Filename = Queue->DestFile;
hm = (CFHTTPMessageRef) CFReadStreamCopyProperty(rs, kCFStreamPropertyHTTPResponseHeader);
UInt32 sc = CFHTTPMessageGetResponseStatusCode(hm);
- size_t offset = 0;
-
sr = CFHTTPMessageCopyHeaderFieldValue(hm, CFSTR("Content-Range"));
if (sr != NULL) {
size_t ln = CFStringGetLength(sr) + 1;
URIStart(Res);
- read: if (rd == -1)
+ read: if (rd == -1) {
+ _error->Error("Stream read failure");
Fail(true);
- else if (rd == 0) {
+ } else if (rd == 0) {
if (Res.Size == 0)
Res.Size = File->Size();