comparison http.c @ 6117:f221641c262a libavformat

Make sure the http protocol handler returns errors if a delayed open had failed
author mstorsjo
date Wed, 09 Jun 2010 09:19:36 +0000
parents 4c91cdcb8a52
children 6b770ef6cbea
comparison
equal deleted inserted replaced
6116:49eedb93140e 6117:f221641c262a
369 if (!s->init) { 369 if (!s->init) {
370 int ret = http_open_cnx(h); 370 int ret = http_open_cnx(h);
371 if (ret != 0) 371 if (ret != 0)
372 return ret; 372 return ret;
373 } 373 }
374 if (!s->hd)
375 return AVERROR(EIO);
374 376
375 /* A size of zero can be used to force 377 /* A size of zero can be used to force
376 * initializaton of the connection. */ 378 * initializaton of the connection. */
377 if (!size) 379 if (!size)
378 return 0; 380 return 0;
427 if (!s->init) { 429 if (!s->init) {
428 int ret = http_open_cnx(h); 430 int ret = http_open_cnx(h);
429 if (ret != 0) 431 if (ret != 0)
430 return ret; 432 return ret;
431 } 433 }
434 if (!s->hd)
435 return AVERROR(EIO);
432 436
433 if (s->chunksize == -1) { 437 if (s->chunksize == -1) {
434 /* headers are sent without any special encoding */ 438 /* headers are sent without any special encoding */
435 return url_write(s->hd, buf, size); 439 return url_write(s->hd, buf, size);
436 } 440 }
483 if (!s->init) { 487 if (!s->init) {
484 int ret = http_open_cnx(h); 488 int ret = http_open_cnx(h);
485 if (ret != 0) 489 if (ret != 0)
486 return ret; 490 return ret;
487 } 491 }
492 if (!s->hd)
493 return AVERROR(EIO);
488 494
489 if (whence == AVSEEK_SIZE) 495 if (whence == AVSEEK_SIZE)
490 return s->filesize; 496 return s->filesize;
491 else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed) 497 else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
492 return -1; 498 return -1;