comparison http.c @ 5009:822a36d7ac0a libavformat

Cosmetics : Use dprintf instead of printf. Patch by Peter Holik < $firstname @ $lastname . at >
author jai_menon
date Sat, 06 Jun 2009 17:32:59 +0000
parents 370160e040d9
children a5b8b8cce2dd
comparison
equal deleted inserted replaced
5008:370160e040d9 5009:822a36d7ac0a
27 #include "os_support.h" 27 #include "os_support.h"
28 28
29 /* XXX: POST protocol is not completely implemented because ffmpeg uses 29 /* XXX: POST protocol is not completely implemented because ffmpeg uses
30 only a subset of it. */ 30 only a subset of it. */
31 31
32 //#define DEBUG
33
34 /* used for protocol handling */ 32 /* used for protocol handling */
35 #define BUFFER_SIZE 1024 33 #define BUFFER_SIZE 1024
36 #define URL_SIZE 4096 34 #define URL_SIZE 4096
37 #define MAX_REDIRECTS 8 35 #define MAX_REDIRECTS 8
38 36
190 while (!isspace(*p) && *p != '\0') 188 while (!isspace(*p) && *p != '\0')
191 p++; 189 p++;
192 while (isspace(*p)) 190 while (isspace(*p))
193 p++; 191 p++;
194 s->http_code = strtol(p, NULL, 10); 192 s->http_code = strtol(p, NULL, 10);
195 #ifdef DEBUG 193
196 printf("http_code=%d\n", s->http_code); 194 dprintf(NULL, "http_code=%d\n", s->http_code);
197 #endif 195
198 /* error codes are 4xx and 5xx */ 196 /* error codes are 4xx and 5xx */
199 if (s->http_code >= 400 && s->http_code < 600) 197 if (s->http_code >= 400 && s->http_code < 600)
200 return -1; 198 return -1;
201 } else { 199 } else {
202 while (*p != '\0' && *p != ':') 200 while (*p != '\0' && *p != ':')
276 274
277 /* wait for header */ 275 /* wait for header */
278 for(;;) { 276 for(;;) {
279 if (http_get_line(s, line, sizeof(line)) < 0) 277 if (http_get_line(s, line, sizeof(line)) < 0)
280 return AVERROR(EIO); 278 return AVERROR(EIO);
281 #ifdef DEBUG 279
282 printf("header='%s'\n", line); 280 dprintf(NULL, "header='%s'\n", line);
283 #endif 281
284 err = process_line(h, line, s->line_count, new_location); 282 err = process_line(h, line, s->line_count, new_location);
285 if (err < 0) 283 if (err < 0)
286 return err; 284 return err;
287 if (err == 0) 285 if (err == 0)
288 break; 286 break;