> ----- Forwarded message from " Marc A. Lehmann " <[EMAIL PROTECTED]> ----- > > Doesn't seem to work, but probably for a trivial reason: It sends two > requests in a pipelined fashion but requests a connection close request > with the first. > > Here are the client requests (single connection): > > GET /Ranma-RedShoeSunday.mp3 HTTP/1.1 > User-Agent: zsync/0.1.6 > Host: frank > Referer: http://frank/Ranma-RedShoeSunday.mp3.zsync > Accept-Ranges: bytes > Range: bytes=4021248-4471807,4472832-4476927 > Connection: close > > GET /Ranma-RedShoeSunday.mp3 HTTP/1.1
Yes, that's a pretty trivial reason. I thought it might interact badly with the http/1.1 code. I have improved my local test and now have a fix for this in the http/1.1 case. I will put out a new version soon enough; if you're interested then here is the diff: --- http.c (revision 274) +++ http.c (working copy) @@ -200,7 +200,7 @@ char buf[4096]; int buf_start, buf_end; long long bytes_down; - int server_close; + int server_close; /* 0: can send more, 1: cannot send more (but one set of headers still to read), 2: cannot send more and all existing headers read */ long long* ranges_todo; int nranges; @@ -351,7 +351,8 @@ if (lastrange) break; } l = strlen(request); - snprintf(request + l, sizeof(request)-l, "\r\n%s\r\n", rf->rangessent == rf->nranges ? "Connection: close\r\n" : ""); + /* Possibly close the connection (and record the fact, so we definitely don't send more stuff) if this is the last */ + snprintf(request + l, sizeof(request)-l, "\r\n%s\r\n", rf->rangessent == rf->nranges ? (rf->server_close = 1, "Connection: close\r\n") : ""); { size_t len = strlen(request); @@ -397,7 +398,7 @@ return -1; } if (*(p-1) == '0') { /* HTTP/1.0 server? */ - rf->server_close = 1; + rf->server_close = 2; } } @@ -427,7 +428,7 @@ rf->rangessent = rf->rangesdone; } if (!strcmp(buf,"connection") && !strcmp(p,"close")) { - rf->server_close = 1; + rf->server_close = 2; } if (!strcasecmp(buf,"content-type") && !strncasecmp(p,"multipart/byteranges",20)) { char *q = strstr(p,"boundary="); @@ -458,7 +459,7 @@ int newconn = 0; int header_result; - if (rf->sd != -1 && rf->server_close) { + if (rf->sd != -1 && rf->server_close == 2) { close(rf->sd); rf->sd = -1; } if (rf->sd == -1) { @@ -470,6 +471,9 @@ } header_result = range_fetch_read_http_headers(rf); + /* Might be the last */ + if (rf->server_close == 1) rf->server_close = 2; + /* EOF on first connect is fatal */ if (newconn && header_result == 0) { fprintf(stderr,"EOF from %s\n",rf->url); > It would probably have worked sans the "Connection: close". I also wonder > why it did try to download two block, because the partial file was created > by partially downloading with wget and pressing ^C, so there should > be onyl one remaining block, but it's quite possible that there was a > repetitive-enough pattern in the mp3 at 4471808-4472832 that zsync detected. Yes, zsync may well have found a repeat; it often manages to find matching blocks far further into the file than expected. -- Colin Phipps <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]