Deleted Added
full compact
http.c (106044) http.c (106185)
1/*-
2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/lib/libfetch/http.c 106044 2002-10-27 15:43:40Z des $");
30__FBSDID("$FreeBSD: head/lib/libfetch/http.c 106185 2002-10-30 04:42:01Z des $");
31
32/*
33 * The following copyright applies to the base64 code:
34 *
35 *-
36 * Copyright 1997 Massachusetts Institute of Technology
37 *
38 * Permission to use, copy, modify, and distribute this software and

--- 152 unchanged lines hidden (view full) ---

191 if (io->error)
192 return (-1);
193 if (io->eof)
194 return (0);
195
196 if (io->chunked == 0) {
197 if (_http_growbuf(io, len) == -1)
198 return (-1);
31
32/*
33 * The following copyright applies to the base64 code:
34 *
35 *-
36 * Copyright 1997 Massachusetts Institute of Technology
37 *
38 * Permission to use, copy, modify, and distribute this software and

--- 152 unchanged lines hidden (view full) ---

191 if (io->error)
192 return (-1);
193 if (io->eof)
194 return (0);
195
196 if (io->chunked == 0) {
197 if (_http_growbuf(io, len) == -1)
198 return (-1);
199 if ((io->buflen = _fetch_read(io->conn, io->buf, len)) == -1)
199 if ((io->buflen = _fetch_read(io->conn, io->buf, len)) == -1) {
200 io->error = 1;
200 return (-1);
201 return (-1);
202 }
201 io->bufpos = 0;
202 return (io->buflen);
203 }
204
205 if (io->chunksize == 0) {
206 switch (_http_new_chunk(io)) {
207 case -1:
208 io->error = 1;
209 return (-1);
210 case 0:
211 io->eof = 1;
212 return (0);
213 }
214 }
215
216 if (len > io->chunksize)
217 len = io->chunksize;
218 if (_http_growbuf(io, len) == -1)
219 return (-1);
203 io->bufpos = 0;
204 return (io->buflen);
205 }
206
207 if (io->chunksize == 0) {
208 switch (_http_new_chunk(io)) {
209 case -1:
210 io->error = 1;
211 return (-1);
212 case 0:
213 io->eof = 1;
214 return (0);
215 }
216 }
217
218 if (len > io->chunksize)
219 len = io->chunksize;
220 if (_http_growbuf(io, len) == -1)
221 return (-1);
220 if ((io->buflen = _fetch_read(io->conn, io->buf, len)) == -1)
222 if ((io->buflen = _fetch_read(io->conn, io->buf, len)) == -1) {
223 io->error = 1;
221 return (-1);
224 return (-1);
225 }
222 io->chunksize -= io->buflen;
223
224 if (io->chunksize == 0) {
225 char endl[2];
226
227 if (_fetch_read(io->conn, endl, 2) != 2 ||
228 endl[0] != '\r' || endl[1] != '\n')
229 return (-1);

--- 914 unchanged lines hidden ---
226 io->chunksize -= io->buflen;
227
228 if (io->chunksize == 0) {
229 char endl[2];
230
231 if (_fetch_read(io->conn, endl, 2) != 2 ||
232 endl[0] != '\r' || endl[1] != '\n')
233 return (-1);

--- 914 unchanged lines hidden ---