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

Function http_open

libavformat/http.c:769–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

767}
768
769static int http_open(URLContext *h, const char *uri, int flags,
770 AVDictionary **options)
771{
772 HTTPContext *s = h->priv_data;
773 int ret;
774
775 if( s->seekable == 1 )
776 h->is_streamed = 0;
777 else
778 h->is_streamed = 1;
779
780 s->initial_requests = s->seekable != 0 && s->initial_request_size > 0;
781 s->filesize = UINT64_MAX;
782
783 s->location = av_strdup(uri);
784 if (!s->location)
785 return AVERROR(ENOMEM);
786
787 s->uri = av_strdup(uri);
788 if (!s->uri)
789 return AVERROR(ENOMEM);
790
791 if (options)
792 av_dict_copy(&s->chained_options, *options, 0);
793
794 if (s->headers) {
795 int len = strlen(s->headers);
796 if (len < 2 || strcmp("\r\n", s->headers + len - 2)) {
797 av_log(h, AV_LOG_WARNING,
798 "No trailing CRLF found in HTTP header. Adding it.\n");
799 ret = av_reallocp(&s->headers, len + 3);
800 if (ret < 0)
801 goto bail_out;
802 s->headers[len] = '\r';
803 s->headers[len + 1] = '\n';
804 s->headers[len + 2] = '\0';
805 }
806 }
807
808 if (s->listen) {
809 return http_listen(h, uri, flags, options);
810 }
811 ret = http_open_cnx(h, options);
812bail_out:
813 if (ret < 0) {
814 av_dict_free(&s->chained_options);
815 av_dict_free(&s->cookie_dict);
816 av_dict_free(&s->redirect_cache);
817 av_freep(&s->new_location);
818 av_freep(&s->uri);
819 }
820 return ret;
821}
822
823static int http_accept(URLContext *s, URLContext **c)
824{

Callers

nothing calls this directly

Calls 8

av_strdupFunction · 0.85
av_dict_copyFunction · 0.85
av_logFunction · 0.85
av_reallocpFunction · 0.85
http_listenFunction · 0.85
http_open_cnxFunction · 0.85
av_dict_freeFunction · 0.85
av_freepFunction · 0.85

Tested by

no test coverage detected