[FFmpeg-devel] [PATCH] HTTP: Simplify the handling of chunked vs non-chunked posts
Ronald S. Bultje
rsbultje
Mon Jun 21 16:02:49 CEST 2010
Hi,
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
variable.
Ronald
More information about the ffmpeg-devel
mailing list