~ubuntu-branches/ubuntu/precise/gst-plugins-bad0.10/precise-proposed

« back to all changes in this revision

Viewing changes to ext/neon/gstneonhttpsrc.c

Tags: upstream-0.10.5.3
Import upstream version 0.10.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#endif
20
20
 
21
21
#include "gstneonhttpsrc.h"
 
22
#include <stdlib.h>
22
23
#include <string.h>
 
24
#ifdef _HAVE_UNISTD_H
23
25
#include <unistd.h>
 
26
#endif /* _HAVE_UNISTD_H */
24
27
 
25
28
#include <ne_redirect.h>
26
29
 
27
 
#ifndef NE_FREE
28
 
#define NEON_026_OR_LATER  1
29
 
#endif
30
 
 
31
30
GST_DEBUG_CATEGORY_STATIC (neonhttpsrc_debug);
32
31
#define GST_CAT_DEFAULT neonhttpsrc_debug
33
32
 
56
55
#define HTTP_DEFAULT_HOST        "localhost"
57
56
 
58
57
/* default properties */
59
 
#define DEFAULT_LOCATION             "http://"HTTP_DEFAULT_HOST"/"G_STRINGIFY(HTTP_DEFAULT_PORT)
 
58
#define DEFAULT_LOCATION             "http://"HTTP_DEFAULT_HOST":"G_STRINGIFY(HTTP_DEFAULT_PORT)
60
59
#define DEFAULT_PROXY                ""
61
60
#define DEFAULT_USER_AGENT           "GStreamer neonhttpsrc"
62
61
#define DEFAULT_IRADIO_MODE          FALSE
286
285
  if (src->location) {
287
286
    ne_free (src->location);
288
287
  }
 
288
  if (src->query_string) {
 
289
    ne_free (src->query_string);
 
290
  }
289
291
 
290
292
  G_OBJECT_CLASS (parent_class)->dispose (gobject);
291
293
}
705
707
    ne_free (src->location);
706
708
    src->location = NULL;
707
709
  }
 
710
  if (src->query_string) {
 
711
    ne_free (src->query_string);
 
712
    src->query_string = NULL;
 
713
  }
708
714
 
709
715
  if (ne_uri_parse (uri, &src->uri) != 0)
710
716
    goto parse_error;
725
731
  if (!src->uri.path)
726
732
    src->uri.path = g_strdup ("");
727
733
 
 
734
  src->query_string = g_strjoin ("?", src->uri.path, src->uri.query, NULL);
 
735
 
728
736
  src->location = ne_uri_unparse (&src->uri);
729
737
 
730
738
  return TRUE;
736
744
      ne_free (src->location);
737
745
      src->location = NULL;
738
746
    }
 
747
    if (src->query_string) {
 
748
      ne_free (src->query_string);
 
749
      src->query_string = NULL;
 
750
    }
739
751
    ne_uri_free (&src->uri);
740
752
    return FALSE;
741
753
  }
756
768
  if (src->proxy.host && !src->proxy.port)
757
769
    goto error;
758
770
 
759
 
#ifdef NEON_026_OR_LATER
760
771
  if (!src->proxy.path || src->proxy.userinfo)
761
772
    goto error;
762
 
#else
763
 
  if (!src->proxy.path || src->proxy.authinfo)
764
 
    goto error;
765
 
#endif
766
773
  return TRUE;
767
774
 
768
775
  /* ERRORS */
799
806
          ne_session_create (src->uri.scheme, src->uri.host, src->uri.port);
800
807
    }
801
808
 
802
 
    request = ne_request_create (session, "GET", src->uri.path);
 
809
    ne_set_session_flag (session, NE_SESSFLAG_ICYPROTO, 1);
 
810
 
 
811
    request = ne_request_create (session, "GET", src->query_string);
803
812
 
804
813
    if (src->user_agent) {
805
814
      ne_add_request_header (request, "User-Agent", src->user_agent);