MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / http_write

Function http_write

libavformat/http.c:361–385  ·  view source on GitHub ↗

used only when posting data */

Source from the content-addressed store, hash-verified

359
360/* used only when posting data */
361static int http_write(URLContext *h, uint8_t *buf, int size)
362{
363 char temp[11]; /* 32-bit hex + CRLF + nul */
364 int ret;
365 char crlf[] = "\r\n";
366 HTTPContext *s = h->priv_data;
367
368 if (s->chunksize == -1) {
369 /* headers are sent without any special encoding */
370 return url_write(s->hd, buf, size);
371 }
372
373 /* silently ignore zero-size data since chunk encoding that would
374 * signal EOF */
375 if (size > 0) {
376 /* upload data using chunked encoding */
377 snprintf(temp, sizeof(temp), "%x\r\n", size);
378
379 if ((ret = url_write(s->hd, temp, strlen(temp))) < 0 ||
380 (ret = url_write(s->hd, buf, size)) < 0 ||
381 (ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
382 return ret;
383 }
384 return size;
385}
386
387static int http_close(URLContext *h)
388{

Callers 1

http_connectFunction · 0.85

Calls 1

url_writeFunction · 0.85

Tested by

no test coverage detected