mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
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.
This commit is contained in:
parent
56c7023d53
commit
a40d677f36
2 changed files with 19 additions and 9 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-03-17 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2008-03-14 Edward Hervey <edward.hervey@collabora.co.uk>
|
2008-03-14 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
|
||||||
* gst-libs/gst/dshow/Makefile.am:
|
* gst-libs/gst/dshow/Makefile.am:
|
||||||
|
|
|
@ -32,7 +32,7 @@ GST_DEBUG_CATEGORY_STATIC (neonhttpsrc_debug);
|
||||||
|
|
||||||
#define MAX_READ_SIZE (4 * 1024)
|
#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
|
#define MAX_HTTP_REDIRECTS_NUMBER 5
|
||||||
|
|
||||||
static const GstElementDetails gst_neonhttp_src_details =
|
static const GstElementDetails gst_neonhttp_src_details =
|
||||||
|
@ -197,7 +197,7 @@ gst_neonhttp_src_class_init (GstNeonhttpSrcClass * klass)
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(gobject_class, PROP_AUTOMATIC_REDIRECT,
|
(gobject_class, PROP_AUTOMATIC_REDIRECT,
|
||||||
g_param_spec_boolean ("automatic-redirect", "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));
|
TRUE, G_PARAM_READWRITE));
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#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
|
/* 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
|
static gint
|
||||||
gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
|
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);
|
res = ne_begin_request (request);
|
||||||
|
|
||||||
if (res == NE_OK) {
|
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 */
|
* Reload the HTTP request with a new URI value */
|
||||||
http_status = ne_get_status (request)->code;
|
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;
|
const gchar *redir;
|
||||||
|
|
||||||
/* the new URI value to go when redirecting can be found on the 'Location' HTTP header */
|
/* 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) ||
|
if ((res != NE_OK) ||
|
||||||
(offset == 0 && http_status != 200) ||
|
(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);
|
ne_request_destroy (request);
|
||||||
request = NULL;
|
request = NULL;
|
||||||
ne_close_connection (session);
|
ne_close_connection (session);
|
||||||
ne_session_destroy (session);
|
ne_session_destroy (session);
|
||||||
session = NULL;
|
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;
|
src->seekable = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if - NE_OK */
|
/* if - NE_OK */
|
||||||
if (http_status == 302 && do_redir) {
|
if ((http_status == 302 || http_status == 303) && do_redir) {
|
||||||
++request_count;
|
++request_count;
|
||||||
GST_WARNING_OBJECT (src, "%s %s.",
|
GST_WARNING_OBJECT (src, "%s %s.",
|
||||||
(request_count < MAX_HTTP_REDIRECTS_NUMBER)
|
(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' */
|
/* do the redirect, go back to send another HTTP request now using the 'Location' */
|
||||||
} while (do_redir && (request_count < MAX_HTTP_REDIRECTS_NUMBER)
|
} while (do_redir && (request_count < MAX_HTTP_REDIRECTS_NUMBER)
|
||||||
&& http_status == 302);
|
&& (http_status == 302 || http_status == 303));
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
*ses = session;
|
*ses = session;
|
||||||
|
|
Loading…
Reference in a new issue