[FFmpeg-devel] [PATCH] HTTP: Simplify the handling of chunked vs non-chunked posts

Martin Storsjö martin
Mon Jun 21 16:22:39 CEST 2010


Hi,

On Mon, 21 Jun 2010, Ronald S. Bultje wrote:

> On Mon, Jun 21, 2010 at 4:45 AM, Martin Storsj? <martin at martin.st> wrote:
> > This simplifies some code in the http protocol, and makes the comments
> > actually reflect what the code does.
> [..]
> > @@ -434,7 +435,7 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
> >          return AVERROR(EIO);
> >
> >      if (s->chunksize == -1) {
> > -        /* headers are sent without any special encoding */
> > +        /* non-chunked data is sent without any special encoding */
> >          return url_write(s->hd, buf, size);
> >      }
> >  @@ -442,16 +443,14 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
> >       * signal EOF */
> >      if (size > 0) {
> >          /* upload data using chunked encoding */
> > -        if(s->is_chunked) {
> >              snprintf(temp, sizeof(temp), "%x\r\n", size);
> >              if ((ret = url_write(s->hd, temp, strlen(temp))) < 0)
> >                  return ret;
> > -        }
> >
> >          if ((ret = url_write(s->hd, buf, size)) < 0)
> >              return ret;
> >
> > -        if (s->is_chunked && (ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
> > +        if ((ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
> >              return ret;
> >      }
> >      return size;
> 
> Why do we have this is_chunked variable again? It should be chunksize
> >=0 chunked, chunksize == -1 => unchuncked. Let's remove that

We have it for setting whether chunked mode is desired for POSTs. I'll try 
to think it through and see if we can eliminate it completely, 
preferrabily in the setup with AVOptions as I posted in the other thread.

// Martin



More information about the ffmpeg-devel mailing list