Merge commit '7a2fddb4480121712df560cf619c1c3566cae3ff'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 12 Mar 2014 01:45:34 +0000 (02:45 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 12 Mar 2014 01:45:34 +0000 (02:45 +0100)
* commit '7a2fddb4480121712df560cf619c1c3566cae3ff':
  http: K&R formatting cosmetics

Conflicts:
libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/http.c

@@@ -390,56 -366,26 +389,60 @@@ static int process_line(URLContext *h, 
                  if ((slash = strchr(p, '/')) && strlen(slash) > 0)
                      s->filesize = strtoll(slash+1, NULL, 10);
              }
 -            h->is_streamed = 0; /* we _can_ in fact seek */
 +            if (s->seekable == -1 && (!s->is_akamai || s->filesize != 2147483647))
 +                h->is_streamed = 0; /* we _can_ in fact seek */
-         } else if (!av_strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5) && s->seekable == -1) {
+         } else if (!av_strcasecmp(tag, "Accept-Ranges") &&
 -                   !strncmp(p, "bytes", 5)) {
++                   !strncmp(p, "bytes", 5) &&
++                   s->seekable == -1) {
              h->is_streamed = 0;
-         } else if (!av_strcasecmp (tag, "Transfer-Encoding") && !av_strncasecmp(p, "chunked", 7)) {
+         } else if (!av_strcasecmp(tag, "Transfer-Encoding") &&
+                    !av_strncasecmp(p, "chunked", 7)) {
              s->filesize = -1;
              s->chunksize = 0;
-         } else if (!av_strcasecmp (tag, "WWW-Authenticate")) {
+         } else if (!av_strcasecmp(tag, "WWW-Authenticate")) {
              ff_http_auth_handle_header(&s->auth_state, tag, p);
-         } else if (!av_strcasecmp (tag, "Authentication-Info")) {
+         } else if (!av_strcasecmp(tag, "Authentication-Info")) {
              ff_http_auth_handle_header(&s->auth_state, tag, p);
-         } else if (!av_strcasecmp (tag, "Proxy-Authenticate")) {
+         } else if (!av_strcasecmp(tag, "Proxy-Authenticate")) {
              ff_http_auth_handle_header(&s->proxy_auth_state, tag, p);
-         } else if (!av_strcasecmp (tag, "Connection")) {
+         } else if (!av_strcasecmp(tag, "Connection")) {
              if (!strcmp(p, "close"))
                  s->willclose = 1;
-         } else if (!av_strcasecmp (tag, "Content-Encoding")) {
-             if (!av_strncasecmp(p, "gzip", 4) || !av_strncasecmp(p, "deflate", 7)) {
 +        } else if (!av_strcasecmp (tag, "Server")) {
 +            if (!av_strcasecmp (p, "AkamaiGHost")) {
 +                s->is_akamai = 1;
 +            } else if (!av_strncasecmp (p, "MediaGateway", 12)) {
 +                s->is_mediagateway = 1;
 +            }
 +        } else if (!av_strcasecmp (tag, "Content-Type")) {
 +            av_free(s->mime_type); s->mime_type = av_strdup(p);
 +        } else if (!av_strcasecmp (tag, "Set-Cookie")) {
 +            if (!s->cookies) {
 +                if (!(s->cookies = av_strdup(p)))
 +                    return AVERROR(ENOMEM);
 +            } else {
 +                char *tmp = s->cookies;
 +                size_t str_size = strlen(tmp) + strlen(p) + 2;
 +                if (!(s->cookies = av_malloc(str_size))) {
 +                    s->cookies = tmp;
 +                    return AVERROR(ENOMEM);
 +                }
 +                snprintf(s->cookies, str_size, "%s\n%s", tmp, p);
 +                av_free(tmp);
 +            }
 +        } else if (!av_strcasecmp (tag, "Icy-MetaInt")) {
 +            s->icy_metaint = strtoll(p, NULL, 10);
 +        } else if (!av_strncasecmp(tag, "Icy-", 4)) {
 +            // Concat all Icy- header lines
 +            char *buf = av_asprintf("%s%s: %s\n",
 +                s->icy_metadata_headers ? s->icy_metadata_headers : "", tag, p);
 +            if (!buf)
 +                return AVERROR(ENOMEM);
 +            av_freep(&s->icy_metadata_headers);
 +            s->icy_metadata_headers = buf;
+         } else if (!av_strcasecmp(tag, "Content-Encoding")) {
+             if (!av_strncasecmp(p, "gzip", 4) ||
+                 !av_strncasecmp(p, "deflate", 7)) {
  #if CONFIG_ZLIB
                  s->compressed = 1;
                  inflateEnd(&s->inflate_stream);