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

Function http_handshake

libavformat/http.c:701–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699}
700
701static int http_handshake(URLContext *c)
702{
703 int ret, err;
704 HTTPContext *ch = c->priv_data;
705 URLContext *cl = ch->hd;
706 switch (ch->handshake_step) {
707 case LOWER_PROTO:
708 av_log(c, AV_LOG_TRACE, "Lower protocol\n");
709 if ((ret = ffurl_handshake(cl)) > 0)
710 return 2 + ret;
711 if (ret < 0)
712 return ret;
713 ch->handshake_step = READ_HEADERS;
714 ch->is_connected_server = 1;
715 return 2;
716 case READ_HEADERS:
717 av_log(c, AV_LOG_TRACE, "Read headers\n");
718 if ((err = http_read_header(c)) < 0) {
719 handle_http_errors(c, err);
720 return err;
721 }
722 ch->handshake_step = WRITE_REPLY_HEADERS;
723 return 1;
724 case WRITE_REPLY_HEADERS:
725 av_log(c, AV_LOG_TRACE, "Reply code: %d\n", ch->reply_code);
726 if ((err = http_write_reply(c, ch->reply_code)) < 0)
727 return err;
728 ch->handshake_step = FINISH;
729 return 1;
730 case FINISH:
731 return 0;
732 }
733 // this should never be reached.
734 return AVERROR(EINVAL);
735}
736
737static int http_listen(URLContext *h, const char *uri, int flags,
738 AVDictionary **options) {

Callers 1

http_listenFunction · 0.85

Calls 5

av_logFunction · 0.85
ffurl_handshakeFunction · 0.85
http_read_headerFunction · 0.85
handle_http_errorsFunction · 0.85
http_write_replyFunction · 0.85

Tested by

no test coverage detected