Lines Matching +full:cs +full:- +full:out
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 2000-2014 Dag-Erling Smørgrav
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 *-
59 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
137 int eof; /* end-of-file flag */
153 if (fetch_getln(io->conn) == -1) in http_new_chunk()
154 return (-1); in http_new_chunk()
156 if (io->conn->buflen < 2 || !isxdigit((unsigned char)*io->conn->buf)) in http_new_chunk()
157 return (-1); in http_new_chunk()
159 for (p = io->conn->buf; *p && !isspace((unsigned char)*p); ++p) { in http_new_chunk()
163 return (-1); in http_new_chunk()
165 io->chunksize = io->chunksize * 16 + in http_new_chunk()
166 *p - '0'; in http_new_chunk()
168 io->chunksize = io->chunksize * 16 + in http_new_chunk()
169 10 + tolower((unsigned char)*p) - 'a'; in http_new_chunk()
175 io->total += io->chunksize; in http_new_chunk()
176 if (io->chunksize == 0) in http_new_chunk()
180 __func__, (unsigned long)io->chunksize, in http_new_chunk()
181 (unsigned long)io->total); in http_new_chunk()
185 return (io->chunksize); in http_new_chunk()
196 if (io->bufsize >= len) in http_growbuf()
199 if ((tmp = realloc(io->buf, len)) == NULL) in http_growbuf()
200 return (-1); in http_growbuf()
201 io->buf = tmp; in http_growbuf()
202 io->bufsize = len; in http_growbuf()
215 if (io->error) in http_fillbuf()
216 return (-1); in http_fillbuf()
217 if (io->eof) in http_fillbuf()
221 if (io->chunked == 0) { in http_fillbuf()
222 if (http_growbuf(io, len) == -1) in http_fillbuf()
223 return (-1); in http_fillbuf()
224 if ((nbytes = fetch_read(io->conn, io->buf, len)) == -1) { in http_fillbuf()
225 io->error = errno; in http_fillbuf()
226 return (-1); in http_fillbuf()
228 io->buflen = nbytes; in http_fillbuf()
229 io->bufpos = 0; in http_fillbuf()
230 return (io->buflen); in http_fillbuf()
233 /* chunked, but we ran out: get the next chunk header */ in http_fillbuf()
234 if (io->chunksize == 0) { in http_fillbuf()
236 case -1: in http_fillbuf()
237 io->error = EPROTO; in http_fillbuf()
238 return (-1); in http_fillbuf()
240 io->eof = 1; in http_fillbuf()
246 if (len > io->chunksize) in http_fillbuf()
247 len = io->chunksize; in http_fillbuf()
248 if (http_growbuf(io, len) == -1) in http_fillbuf()
249 return (-1); in http_fillbuf()
250 if ((nbytes = fetch_read(io->conn, io->buf, len)) == -1) { in http_fillbuf()
251 io->error = errno; in http_fillbuf()
252 return (-1); in http_fillbuf()
254 io->bufpos = 0; in http_fillbuf()
255 io->buflen = nbytes; in http_fillbuf()
256 io->chunksize -= nbytes; in http_fillbuf()
258 if (io->chunksize == 0) { in http_fillbuf()
259 if (fetch_read(io->conn, &ch, 1) != 1 || ch != '\r' || in http_fillbuf()
260 fetch_read(io->conn, &ch, 1) != 1 || ch != '\n') in http_fillbuf()
261 return (-1); in http_fillbuf()
264 return (io->buflen); in http_fillbuf()
276 if (io->error) in http_readfn()
277 return (-1); in http_readfn()
278 if (io->eof) in http_readfn()
282 if (!io->buf || io->bufpos == io->buflen) { in http_readfn()
284 if ((errno = io->error) == EINTR) in http_readfn()
285 io->error = 0; in http_readfn()
286 return (-1); in http_readfn()
292 rlen = io->buflen - io->bufpos; in http_readfn()
295 memcpy(buf, io->buf + io->bufpos, rlen); in http_readfn()
296 io->bufpos += rlen; in http_readfn()
308 return (fetch_write(io->conn, buf, len)); in http_writefn()
320 r = fetch_close(io->conn); in http_closefn()
321 if (io->buf) in http_closefn()
322 free(io->buf); in http_closefn()
340 io->conn = conn; in http_funopen()
341 io->chunked = chunked; in http_funopen()
358 hdr_syserror = -2,
359 hdr_error = -1,
376 { hdr_content_length, "Content-Length" },
377 { hdr_content_range, "Content-Range" },
378 { hdr_last_modified, "Last-Modified" },
380 { hdr_transfer_encoding, "Transfer-Encoding" },
381 { hdr_www_authenticate, "WWW-Authenticate" },
382 { hdr_proxy_authenticate, "Proxy-Authenticate" },
404 return (-1); in http_cmd()
410 if (r == -1) { in http_cmd()
412 return (-1); in http_cmd()
426 if (fetch_getln(conn) == -1) in http_get_reply()
427 return (-1); in http_get_reply()
432 * Unfortunately, there are servers out there (NCSA 1.5.1, to name in http_get_reply()
437 if (strncmp(conn->buf, "HTTP", 4) != 0) in http_get_reply()
439 p = conn->buf + 4; in http_get_reply()
451 conn->err = (p[1] - '0') * 100 + (p[2] - '0') * 10 + (p[3] - '0'); in http_get_reply()
452 return (conn->err); in http_get_reply()
505 buf->buf = NULL; in init_http_headerbuf()
506 buf->bufsize = 0; in init_http_headerbuf()
507 buf->buflen = 0; in init_http_headerbuf()
513 if (buf->buf) in clean_http_headerbuf()
514 free(buf->buf); in clean_http_headerbuf()
522 while (conn->buflen && in http_conn_trimright()
523 isspace((unsigned char)conn->buf[conn->buflen - 1])) in http_conn_trimright()
524 conn->buflen--; in http_conn_trimright()
525 conn->buf[conn->buflen] = '\0'; in http_conn_trimright()
538 if (conn->buflen == 0) in http_next_header()
542 if (hbuf->bufsize < conn->buflen + 1) { in http_next_header()
543 if ((hbuf->buf = realloc(hbuf->buf, conn->buflen + 1)) == NULL) in http_next_header()
545 hbuf->bufsize = conn->buflen + 1; in http_next_header()
547 strcpy(hbuf->buf, conn->buf); in http_next_header()
548 hbuf->buflen = conn->buflen; in http_next_header()
551 * Fetch possible continuation lines. Stop at 1st non-continuation in http_next_header()
555 if (fetch_getln(conn) == -1) in http_next_header()
565 if (conn->buf[0] != ' ' && conn->buf[0] != "\t"[0]) in http_next_header()
569 len = hbuf->buflen + conn->buflen; in http_next_header()
570 if (hbuf->bufsize < len + 1) { in http_next_header()
572 if ((hbuf->buf = realloc(hbuf->buf, len + 1)) == NULL) in http_next_header()
574 hbuf->bufsize = len + 1; in http_next_header()
576 strcpy(hbuf->buf + hbuf->buflen, conn->buf); in http_next_header()
577 hbuf->buflen += conn->buflen; in http_next_header()
583 * colon; a token is any sequence of non-control, non-whitespace in http_next_header()
587 if ((*p = http_match(hdr_names[i].name, hbuf->buf)) != NULL) in http_next_header()
594 * [Proxy-]Authenticate header parsing
598 * Read doublequote-delimited string into output buffer obuf (allocated
646 b->scheme = HTTPAS_UNKNOWN; in init_http_auth_challenge()
647 b->realm = b->qop = b->nonce = b->opaque = b->algo = NULL; in init_http_auth_challenge()
648 b->stale = b->nc = 0; in init_http_auth_challenge()
654 if (b->realm) in clean_http_auth_challenge()
655 free(b->realm); in clean_http_auth_challenge()
656 if (b->qop) in clean_http_auth_challenge()
657 free(b->qop); in clean_http_auth_challenge()
658 if (b->nonce) in clean_http_auth_challenge()
659 free(b->nonce); in clean_http_auth_challenge()
660 if (b->opaque) in clean_http_auth_challenge()
661 free(b->opaque); in clean_http_auth_challenge()
662 if (b->algo) in clean_http_auth_challenge()
663 free(b->algo); in clean_http_auth_challenge()
676 init_http_auth_challenges(http_auth_challenges_t *cs) in init_http_auth_challenges() argument
680 cs->challenges[i] = NULL; in init_http_auth_challenges()
681 cs->count = cs->valid = 0; in init_http_auth_challenges()
685 clean_http_auth_challenges(http_auth_challenges_t *cs) in clean_http_auth_challenges() argument
688 /* We rely on non-zero pointers being allocated, not on the count */ in clean_http_auth_challenges()
690 if (cs->challenges[i] != NULL) { in clean_http_auth_challenges()
691 clean_http_auth_challenge(cs->challenges[i]); in clean_http_auth_challenges()
692 free(cs->challenges[i]); in clean_http_auth_challenges()
695 init_http_auth_challenges(cs); in clean_http_auth_challenges()
740 * Read challenges from http xxx-authenticate header and accumulate them
746 * the same name are only allowed for pure comma-separated lists, see
752 http_parse_authenticate(const char *cp, http_auth_challenges_t *cs) in http_parse_authenticate() argument
754 int ret = -1; in http_parse_authenticate()
762 goto out; in http_parse_authenticate()
766 cs->valid = 1; in http_parse_authenticate()
771 goto out; in http_parse_authenticate()
774 for (; cs->count < MAX_CHALLENGES; cs->count++) { in http_parse_authenticate()
775 cs->challenges[cs->count] = in http_parse_authenticate()
777 if (cs->challenges[cs->count] == NULL) { in http_parse_authenticate()
779 goto out; in http_parse_authenticate()
781 init_http_auth_challenge(cs->challenges[cs->count]); in http_parse_authenticate()
783 cs->challenges[cs->count]->scheme = HTTPAS_BASIC; in http_parse_authenticate()
785 cs->challenges[cs->count]->scheme = HTTPAS_DIGEST; in http_parse_authenticate()
787 cs->challenges[cs->count]->scheme = HTTPAS_UNKNOWN; in http_parse_authenticate()
801 goto out; in http_parse_authenticate()
806 goto out; in http_parse_authenticate()
811 goto out; in http_parse_authenticate()
814 cs->challenges[cs->count]->realm = in http_parse_authenticate()
817 cs->challenges[cs->count]->qop = in http_parse_authenticate()
820 cs->challenges[cs->count]->nonce = in http_parse_authenticate()
823 cs->challenges[cs->count]->opaque = in http_parse_authenticate()
826 cs->challenges[cs->count]->algo = in http_parse_authenticate()
829 cs->challenges[cs->count]->stale = in http_parse_authenticate()
846 cs->count++; in http_parse_authenticate()
848 goto out; in http_parse_authenticate()
852 goto out; in http_parse_authenticate()
859 * with normal data, something's fishy -> error in http_parse_authenticate()
862 out: in http_parse_authenticate()
874 * Parse a last-modified header
891 /* XXX should add support for date-2 and date-3 */ in http_parse_mtime()
894 return (-1); in http_parse_mtime()
895 DEBUGF("last modified: [%04d-%02d-%02d %02d:%02d:%02d]\n", in http_parse_mtime()
903 * Parse a content-length header
911 len = len * 10 + (*p - '0'); in http_parse_length()
913 return (-1); in http_parse_length()
920 * Parse a content-range header
928 return (-1); in http_parse_range()
931 first = last = -1; in http_parse_range()
935 first = first * 10 + *p - '0'; in http_parse_range()
936 if (*p != '-') in http_parse_range()
937 return (-1); in http_parse_range()
939 last = last * 10 + *p - '0'; in http_parse_range()
942 return (-1); in http_parse_range()
944 len = len * 10 + *p - '0'; in http_parse_range()
945 if (*p || len < last - first + 1) in http_parse_range()
946 return (-1); in http_parse_range()
947 if (first == -1) { in http_parse_range()
951 DEBUGF("content range: [%lld-%lld/%lld]\n", in http_parse_range()
953 *length = last - first + 1; in http_parse_range()
990 src += 3; l -= 3; in http_base64()
1033 s->scheme = s->realm = s->user = s->password = NULL; in init_http_auth_params()
1039 if (s->scheme) in clean_http_auth_params()
1040 free(s->scheme); in clean_http_auth_params()
1041 if (s->realm) in clean_http_auth_params()
1042 free(s->realm); in clean_http_auth_params()
1043 if (s->user) in clean_http_auth_params()
1044 free(s->user); in clean_http_auth_params()
1045 if (s->password) in clean_http_auth_params()
1046 free(s->password); in clean_http_auth_params()
1053 int ret = -1; in http_authfromenv()
1059 return (-1); in http_authfromenv()
1064 goto out; in http_authfromenv()
1067 if ((parms->scheme = strdup(v)) == NULL) { in http_authfromenv()
1069 goto out; in http_authfromenv()
1074 goto out; in http_authfromenv()
1077 if ((parms->realm = strdup(v)) == NULL) { in http_authfromenv()
1079 goto out; in http_authfromenv()
1084 goto out; in http_authfromenv()
1087 if ((parms->user = strdup(v)) == NULL) { in http_authfromenv()
1089 goto out; in http_authfromenv()
1094 if ((parms->password = strdup(v)) == NULL) { in http_authfromenv()
1096 goto out; in http_authfromenv()
1099 out: in http_authfromenv()
1100 if (ret == -1) in http_authfromenv()
1113 #define OUT macro
1122 CvtHex(IN HASH Bin, OUT HASHHEX Hex) in CvtHex()
1145 OUT HASHHEX SessionKey in DigestCalcHA1()
1158 if (strcasecmp(pszAlg, "md5-sess") == 0) { in DigestCalcHA1()
1171 /* calculate request-digest/response-digest as per HTTP Digest spec */
1178 IN char * pszQop, /* qop-value: "", "auth", "auth-int" */ in DigestCalcResponse()
1181 IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ in DigestCalcResponse()
1182 OUT HASHHEX Response /* request-digest or response-digest */ in DigestCalcResponse()
1199 if (strcasecmp(pszQop, "auth-int") == 0) { in DigestCalcResponse()
1227 * This looks like: [Proxy-]Authorization: credentials
1229 * credentials = "Digest" digest-response
1230 * digest-response = 1#( username | realm | nonce | digest-uri
1232 * [opaque] | [message-qop] |
1233 * [nonce-count] | [auth-param] )
1234 * username = "username" "=" username-value
1235 * username-value = quoted-string
1236 * digest-uri = "uri" "=" digest-uri-value
1237 * digest-uri-value = request-uri ; As specified by HTTP/1.1
1238 * message-qop = "qop" "=" qop-value
1239 * cnonce = "cnonce" "=" cnonce-value
1240 * cnonce-value = nonce-value
1241 * nonce-count = "nc" "=" nc-value
1242 * nc-value = 8LHEX
1243 * response = "response" "=" request-digest
1244 * request-digest = <"> 32LHEX <">
1255 if (!c->realm || !c->nonce) { in http_digest_auth()
1257 return(-1); in http_digest_auth()
1259 if (!c->algo) in http_digest_auth()
1260 c->algo = strdup(""); in http_digest_auth()
1263 *c->algo? ",algorithm=" : "", c->algo, in http_digest_auth()
1264 c->opaque? ",opaque=" : "", c->opaque?c->opaque:"") < 0) in http_digest_auth()
1265 return (-1); in http_digest_auth()
1267 if (!c->qop) { in http_digest_auth()
1268 c->qop = strdup(""); in http_digest_auth()
1272 c->nc++; in http_digest_auth()
1273 sprintf(noncecount, "%08x", c->nc); in http_digest_auth()
1279 DigestCalcHA1(c->algo, parms->user, c->realm, in http_digest_auth()
1280 parms->password, c->nonce, cnonce, HA1); in http_digest_auth()
1284 DigestCalcResponse(HA1, c->nonce, noncecount, cnonce, c->qop, in http_digest_auth()
1285 "GET", url->doc, null, digest); in http_digest_auth()
1287 if (c->qop[0]) { in http_digest_auth()
1291 hdr, parms->user, c->realm, in http_digest_auth()
1292 c->nonce, url->doc, digest, in http_digest_auth()
1297 hdr, parms->user, c->realm, in http_digest_auth()
1298 c->nonce, url->doc, digest, options); in http_digest_auth()
1316 if (asprintf(&upw, "%s:%s", usr, pwd) == -1) in http_basic_auth()
1317 return (-1); in http_basic_auth()
1321 return (-1); in http_basic_auth()
1332 http_authorize(conn_t *conn, const char *hdr, http_auth_challenges_t *cs, in http_authorize() argument
1339 if (!parms->user || !parms->password) { in http_authorize()
1341 return (-1); in http_authorize()
1345 for (i = 0; i < cs->count; i++) { in http_authorize()
1346 if (cs->challenges[i]->scheme == HTTPAS_DIGEST) in http_authorize()
1347 digest = cs->challenges[i]; in http_authorize()
1352 (parms->scheme && strcasecmp(parms->scheme, "digest") == 0)) { in http_authorize()
1354 return (-1); in http_authorize()
1362 (parms->scheme && strcasecmp(parms->scheme, "basic") == 0)) in http_authorize()
1363 return (http_basic_auth(conn,hdr,parms->user,parms->password)); in http_authorize()
1407 if ((conn = fetch_connect(curl->host, curl->port, af, verbose)) == NULL) in http_connect()
1411 if (strcmp(URL->scheme, SCHEME_HTTPS) == 0 && purl) { in http_connect()
1413 http_cmd(conn, "CONNECT %s:%d HTTP/1.1", URL->host, URL->port); in http_connect()
1414 http_cmd(conn, "Host: %s:%d", URL->host, URL->port); in http_connect()
1418 if (*purl->user || *purl->pwd) { in http_connect()
1419 aparams.user = strdup(purl->user); in http_connect()
1420 aparams.password = strdup(purl->pwd); in http_connect()
1429 aparams.user = strdup(purl->user); in http_connect()
1430 aparams.password = strdup(purl->pwd); in http_connect()
1433 * No auth information found in system - exiting in http_connect()
1440 http_authorize(conn, "Proxy-Authorization", in http_connect()
1478 if (strcmp(URL->scheme, SCHEME_HTTPS) == 0 && in http_connect()
1479 fetch_ssl(conn, URL, verbose) == -1) { in http_connect()
1487 setsockopt(conn->sd, IPPROTO_TCP, TCP_NOPUSH, &val, sizeof(val)); in http_connect()
1507 if (fetch_no_proxy_match(url->host)) in http_get_proxy()
1511 if (!*purl->scheme) in http_get_proxy()
1512 strcpy(purl->scheme, SCHEME_HTTP); in http_get_proxy()
1513 if (!purl->port) in http_get_proxy()
1514 purl->port = fetch_default_proxy_port(purl->scheme); in http_get_proxy()
1515 if (strcmp(purl->scheme, SCHEME_HTTP) == 0) in http_get_proxy()
1523 http_print_html(FILE *out, FILE *in) in http_print_html() argument
1532 while (len && isspace((unsigned char)line[len - 1])) in http_print_html()
1533 --len; in http_print_html()
1535 if (comment && *q == '-') { in http_print_html()
1537 strcmp(q, "-->") == 0) { in http_print_html()
1546 fwrite(p, q - p, 1, out); in http_print_html()
1549 strcmp(q, "<!--") == 0) { in http_print_html()
1556 fwrite(p, q - p, 1, out); in http_print_html()
1557 fputc('\n', out); in http_print_html()
1630 clength = -1; in http_request_body()
1631 length = -1; in http_request_body()
1632 size = -1; in http_request_body()
1636 if (!url->port) in http_request_body()
1637 url->port = fetch_default_port(url->scheme); in http_request_body()
1640 if (purl == NULL && strcmp(url->scheme, SCHEME_FTP) == 0) { in http_request_body()
1652 host = url->host; in http_request_body()
1653 if (url->port != fetch_default_port(url->scheme)) { in http_request_body()
1654 snprintf(hbuf, sizeof(hbuf), "%s:%d", host, url->port); in http_request_body()
1661 url->scheme, host, url->doc); in http_request_body()
1662 if (purl && strcmp(url->scheme, SCHEME_HTTPS) != 0) { in http_request_body()
1664 op, url->scheme, host, url->doc); in http_request_body()
1667 op, url->doc); in http_request_body()
1670 if (ims && url->ims_time) { in http_request_body()
1671 timestruct = gmtime((time_t *)&url->ims_time); in http_request_body()
1675 fetch_info("If-Modified-Since: %s", timebuf); in http_request_body()
1676 http_cmd(conn, "If-Modified-Since: %s", timebuf); in http_request_body()
1684 * when support was added for digest-auth) in http_request_body()
1689 if (*purl->user || *purl->pwd) { in http_request_body()
1690 aparams.user = strdup(purl->user); in http_request_body()
1691 aparams.password = strdup(purl->pwd); in http_request_body()
1699 aparams.user = strdup(purl->user); in http_request_body()
1700 aparams.password = strdup(purl->pwd); in http_request_body()
1702 http_authorize(conn, "Proxy-Authorization", in http_request_body()
1713 * pre-digest version to do this when Basic was specified in http_request_body()
1719 if (*url->user || *url->pwd) { in http_request_body()
1720 aparams.user = strdup(url->user); in http_request_body()
1721 aparams.password = strdup(url->pwd); in http_request_body()
1729 aparams.user = strdup(url->user); in http_request_body()
1730 aparams.password = strdup(url->pwd); in http_request_body()
1733 aparams.user = strdup(url->user); in http_request_body()
1734 aparams.password = strdup(url->pwd); in http_request_body()
1754 url->scheme, host, url->doc); in http_request_body()
1759 /* no User-Agent if defined but empty */ in http_request_body()
1761 http_cmd(conn, "User-Agent: %s", p); in http_request_body()
1763 /* default User-Agent */ in http_request_body()
1764 http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, in http_request_body()
1767 if (url->offset > 0) in http_request_body()
1768 http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset); in http_request_body()
1773 http_cmd(conn, "Content-Length: %zu", body_len); in http_request_body()
1775 http_cmd(conn, "Content-Type: %s", content_type); in http_request_body()
1786 * configured to disallow such half-closed connections. To in http_request_body()
1791 setsockopt(conn->sd, IPPROTO_TCP, TCP_NOPUSH, &val, in http_request_body()
1794 setsockopt(conn->sd, IPPROTO_TCP, TCP_NODELAY, &val, in http_request_body()
1818 * We already sent out authorization code, in http_request_body()
1821 http_seterr(conn->err); in http_request_body()
1834 http_seterr(conn->err); in http_request_body()
1850 case -1: in http_request_body()
1854 http_seterr(conn->err); in http_request_body()
1861 if (fetch_getln(conn) == -1) { in http_request_body()
1883 if (!HTTP_REDIRECT(conn->err)) in http_request_body()
1890 conn->err != HTTP_MOVED_PERM && in http_request_body()
1891 conn->err != HTTP_PERM_REDIRECT && in http_request_body()
1892 conn->err != HTTP_USE_PROXY) { in http_request_body()
1900 conn->err, p); in http_request_body()
1903 new = fetchMakeURL(url->scheme, url->host, in http_request_body()
1904 url->port, p, url->user, url->pwd); in http_request_body()
1914 if (strcmp(new->host, url->host) == 0 && in http_request_body()
1915 !*new->user && !*new->pwd) { in http_request_body()
1916 strcpy(new->user, url->user); in http_request_body()
1917 strcpy(new->pwd, url->pwd); in http_request_body()
1919 new->offset = url->offset; in http_request_body()
1920 new->length = url->length; in http_request_body()
1921 new->ims_time = url->ims_time; in http_request_body()
1928 if (conn->err != HTTP_NEED_AUTH) in http_request_body()
1934 if (conn->err != HTTP_NEED_PROXY_AUTH) in http_request_body()
1948 if (conn->err == HTTP_NEED_AUTH || in http_request_body()
1949 conn->err == HTTP_NEED_PROXY_AUTH) { in http_request_body()
1950 e = conn->err; in http_request_body()
1951 if ((conn->err == HTTP_NEED_AUTH && in http_request_body()
1953 (conn->err == HTTP_NEED_PROXY_AUTH && in http_request_body()
1955 /* 401/7 but no www/proxy-authenticate ?? */ in http_request_body()
1956 DEBUGF("%03d without auth header\n", conn->err); in http_request_body()
1965 if (conn->err == HTTP_BAD_RANGE) { in http_request_body()
1966 if (url->offset > 0 && url->length == 0) { in http_request_body()
1968 offset = url->offset; in http_request_body()
1969 clength = -1; in http_request_body()
1970 conn->err = HTTP_OK; in http_request_body()
1973 http_seterr(conn->err); in http_request_body()
1979 if (conn->err == HTTP_OK in http_request_body()
1980 || conn->err == HTTP_NOT_MODIFIED in http_request_body()
1981 || conn->err == HTTP_PARTIAL in http_request_body()
1982 || HTTP_ERROR(conn->err)) in http_request_body()
1986 e = conn->err; in http_request_body()
1999 /* we failed, or ran out of retries */ in http_request_body()
2009 if (conn->err == HTTP_NOT_MODIFIED) { in http_request_body()
2015 if (clength != -1 && length != -1 && clength != length) { in http_request_body()
2019 if (clength == -1) in http_request_body()
2021 if (clength != -1) in http_request_body()
2023 if (length != -1 && size != -1 && length != size) { in http_request_body()
2027 if (size == -1) in http_request_body()
2032 us->size = size; in http_request_body()
2033 us->atime = us->mtime = mtime; in http_request_body()
2037 if (URL->offset > 0 && offset > URL->offset) { in http_request_body()
2043 URL->offset = offset; in http_request_body()
2044 URL->length = clength; in http_request_body()
2057 if (HTTP_ERROR(conn->err)) { in http_request_body()
2123 return (-1); in fetchStatHTTP()