summaryrefslogtreecommitdiffstats
path: root/ext/neon
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-03-17 09:02:43 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-03-17 09:02:43 +0000
commita40d677f366fc231ef5b2713c4e84fbd5e11ecf4 (patch)
tree5af11c054a0a0b0373ab314105ff80786cfbb7e0 /ext/neon
parent56c7023d533608843fb5c8f49a3710a68687beb6 (diff)
downloadgst-plugins-bad-a40d677f366fc231ef5b2713c4e84fbd5e11ecf4.tar.gz
gst-plugins-bad-a40d677f366fc231ef5b2713c4e84fbd5e11ecf4.tar.bz2
gst-plugins-bad-a40d677f366fc231ef5b2713c4e84fbd5e11ecf4.zip
ext/neon/gstneonhttpsrc.c: Handle HTTP status code 303 (See Other) the same way as 302 (Found). Not sure what to do a...
Original commit message from CVS: * ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_class_init), (gst_neonhttp_src_send_request_and_redirect): Handle HTTP status code 303 (See Other) the same way as 302 (Found). Not sure what to do about all the other 3xx redirect status codes. Fixes bug #522884.
Diffstat (limited to 'ext/neon')
-rw-r--r--ext/neon/gstneonhttpsrc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/ext/neon/gstneonhttpsrc.c b/ext/neon/gstneonhttpsrc.c
index 0d3fac02..0ad6339d 100644
--- a/ext/neon/gstneonhttpsrc.c
+++ b/ext/neon/gstneonhttpsrc.c
@@ -32,7 +32,7 @@ GST_DEBUG_CATEGORY_STATIC (neonhttpsrc_debug);
#define MAX_READ_SIZE (4 * 1024)
-/* max number of HTTP redirects, when iterating over a sequence of HTTP 302 status code */
+/* max number of HTTP redirects, when iterating over a sequence of HTTP 302/303 status code */
#define MAX_HTTP_REDIRECTS_NUMBER 5
static const GstElementDetails gst_neonhttp_src_details =
@@ -197,7 +197,7 @@ gst_neonhttp_src_class_init (GstNeonhttpSrcClass * klass)
g_object_class_install_property
(gobject_class, PROP_AUTOMATIC_REDIRECT,
g_param_spec_boolean ("automatic-redirect", "automatic-redirect",
- "Automatically follow HTTP redirects (HTTP Status Code 302)",
+ "Automatically follow HTTP redirects (HTTP Status Code 302/303)",
TRUE, G_PARAM_READWRITE));
#ifndef GST_DISABLE_GST_DEBUG
@@ -781,7 +781,7 @@ error:
}
/* Try to send the HTTP request to the Icecast server, and if possible deals with
- * all the probable redirections (HTTP status code == 302)
+ * all the probable redirections (HTTP status code == 302/303)
*/
static gint
gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
@@ -826,10 +826,10 @@ gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
res = ne_begin_request (request);
if (res == NE_OK) {
- /* When the HTTP status code is 302, it is not the SHOUTcast streaming content yet;
+ /* When the HTTP status code is 302/303, it is not the SHOUTcast streaming content yet;
* Reload the HTTP request with a new URI value */
http_status = ne_get_status (request)->code;
- if (http_status == 302 && do_redir) {
+ if ((http_status == 302 || http_status == 303) && do_redir) {
const gchar *redir;
/* the new URI value to go when redirecting can be found on the 'Location' HTTP header */
@@ -849,19 +849,21 @@ gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
if ((res != NE_OK) ||
(offset == 0 && http_status != 200) ||
- (offset > 0 && http_status != 206 && http_status != 302)) {
+ (offset > 0 && http_status != 206 && http_status != 302
+ && http_status != 303)) {
ne_request_destroy (request);
request = NULL;
ne_close_connection (session);
ne_session_destroy (session);
session = NULL;
- if (offset > 0 && http_status != 206 && http_status != 302) {
+ if (offset > 0 && http_status != 206 && http_status != 302
+ && http_status != 303) {
src->seekable = FALSE;
}
}
/* if - NE_OK */
- if (http_status == 302 && do_redir) {
+ if ((http_status == 302 || http_status == 303) && do_redir) {
++request_count;
GST_WARNING_OBJECT (src, "%s %s.",
(request_count < MAX_HTTP_REDIRECTS_NUMBER)
@@ -877,7 +879,7 @@ gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
}
/* do the redirect, go back to send another HTTP request now using the 'Location' */
} while (do_redir && (request_count < MAX_HTTP_REDIRECTS_NUMBER)
- && http_status == 302);
+ && (http_status == 302 || http_status == 303));
if (session) {
*ses = session;