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

Function http_write

libavformat/http.c:2000–2024  ·  view source on GitHub ↗

used only when posting data */

Source from the content-addressed store, hash-verified

1998
1999/* used only when posting data */
2000static int http_write(URLContext *h, const uint8_t *buf, int size)
2001{
2002 char temp[11] = ""; /* 32-bit hex + CRLF + nul */
2003 int ret;
2004 char crlf[] = "\r\n";
2005 HTTPContext *s = h->priv_data;
2006
2007 if (!s->chunked_post) {
2008 /* non-chunked data is sent without any special encoding */
2009 return ffurl_write(s->hd, buf, size);
2010 }
2011
2012 /* silently ignore zero-size data since chunk encoding that would
2013 * signal EOF */
2014 if (size > 0) {
2015 /* upload data using chunked encoding */
2016 snprintf(temp, sizeof(temp), "%x\r\n", size);
2017
2018 if ((ret = ffurl_write(s->hd, temp, strlen(temp))) < 0 ||
2019 (ret = ffurl_write(s->hd, buf, size)) < 0 ||
2020 (ret = ffurl_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
2021 return ret;
2022 }
2023 return size;
2024}
2025
2026static int http_shutdown(URLContext *h, int flags)
2027{

Callers

nothing calls this directly

Calls 1

ffurl_writeFunction · 0.85

Tested by

no test coverage detected