uses client_write() now
This commit is contained in:
parent
39abde5db5
commit
79beebdabe
@ -149,6 +149,7 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
long bodywrites=0;
|
long bodywrites=0;
|
||||||
|
|
||||||
char newurl[URL_MAX_LENGTH]; /* buffer for Location: URL */
|
char newurl[URL_MAX_LENGTH]; /* buffer for Location: URL */
|
||||||
|
int writetype;
|
||||||
|
|
||||||
/* the highest fd we use + 1 */
|
/* the highest fd we use + 1 */
|
||||||
struct UrlData *data;
|
struct UrlData *data;
|
||||||
@ -336,24 +337,15 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
|
|
||||||
/* now, only output this if the header AND body are requested:
|
/* now, only output this if the header AND body are requested:
|
||||||
*/
|
*/
|
||||||
if (data->bits.http_include_header) {
|
writetype = CLIENTWRITE_HEADER;
|
||||||
if((p - data->headerbuff) !=
|
if (data->bits.http_include_header)
|
||||||
data->fwrite (data->headerbuff, 1,
|
writetype |= CLIENTWRITE_BODY;
|
||||||
p - data->headerbuff, data->out)) {
|
|
||||||
failf (data, "Failed writing output");
|
urg = client_write(data, writetype, data->headerbuff,
|
||||||
return CURLE_WRITE_ERROR;
|
p - data->headerbuff);
|
||||||
}
|
if(urg)
|
||||||
}
|
return urg;
|
||||||
if(data->writeheader) {
|
|
||||||
/* obviously, the header is requested to be written to
|
|
||||||
this file: */
|
|
||||||
if((p - data->headerbuff) !=
|
|
||||||
data->fwrite (data->headerbuff, 1, p - data->headerbuff,
|
|
||||||
data->writeheader)) {
|
|
||||||
failf (data, "Failed writing output");
|
|
||||||
return CURLE_WRITE_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->header_size += p - data->headerbuff;
|
data->header_size += p - data->headerbuff;
|
||||||
break; /* exit header line loop */
|
break; /* exit header line loop */
|
||||||
}
|
}
|
||||||
@ -406,6 +398,8 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
data->timecondition) {
|
data->timecondition) {
|
||||||
time_t secs=time(NULL);
|
time_t secs=time(NULL);
|
||||||
timeofdoc = curl_getdate(p+strlen("Last-Modified:"), &secs);
|
timeofdoc = curl_getdate(p+strlen("Last-Modified:"), &secs);
|
||||||
|
if(data->bits.get_filetime)
|
||||||
|
data->progress.filetime = timeofdoc;
|
||||||
}
|
}
|
||||||
else if ((code >= 300 && code < 400) &&
|
else if ((code >= 300 && code < 400) &&
|
||||||
(data->bits.http_follow_location) &&
|
(data->bits.http_follow_location) &&
|
||||||
@ -416,21 +410,15 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
instead */
|
instead */
|
||||||
data->newurl = strdup (newurl);
|
data->newurl = strdup (newurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->bits.http_include_header) {
|
writetype = CLIENTWRITE_HEADER;
|
||||||
if(hbuflen != data->fwrite (p, 1, hbuflen, data->out)) {
|
if (data->bits.http_include_header)
|
||||||
failf (data, "Failed writing output");
|
writetype |= CLIENTWRITE_BODY;
|
||||||
return CURLE_WRITE_ERROR;
|
|
||||||
}
|
urg = client_write(data, writetype, p, hbuflen);
|
||||||
}
|
if(urg)
|
||||||
if(data->writeheader) {
|
return urg;
|
||||||
/* the header is requested to be written to this file */
|
|
||||||
if(hbuflen != data->fwrite (p, 1, hbuflen,
|
|
||||||
data->writeheader)) {
|
|
||||||
failf (data, "Failed writing output");
|
|
||||||
return CURLE_WRITE_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data->header_size += hbuflen;
|
data->header_size += hbuflen;
|
||||||
|
|
||||||
/* reset hbufp pointer && hbuflen */
|
/* reset hbufp pointer && hbuflen */
|
||||||
@ -515,10 +503,9 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
|
|
||||||
pgrsSetDownloadCounter(data, (double)bytecount);
|
pgrsSetDownloadCounter(data, (double)bytecount);
|
||||||
|
|
||||||
if (nread != data->fwrite (str, 1, nread, data->out)) {
|
urg = client_write(data, CLIENTWRITE_BODY, str, nread);
|
||||||
failf (data, "Failed writing output");
|
if(urg)
|
||||||
return CURLE_WRITE_ERROR;
|
return urg;
|
||||||
}
|
|
||||||
|
|
||||||
} /* if (! header and data to read ) */
|
} /* if (! header and data to read ) */
|
||||||
} /* if( read from socket ) */
|
} /* if( read from socket ) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user