mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
ext/neon/gstneonhttpsrc.c: Clean up the debug logging code and #ifdef mess a bit: whether or not gstreamer debug mess...
Original commit message from CVS: * ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_start), (gst_neonhttp_src_send_request_and_redirect): Clean up the debug logging code and #ifdef mess a bit: whether or not gstreamer debug messages should be output should not depend on an element property; also, GST_ELEMENT_ERROR will leave a line in the log already, so merge the more useful debug log messages with the less useful error debug strings.
This commit is contained in:
parent
028352c5e0
commit
52fd692bcf
2 changed files with 26 additions and 37 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-09-17 Tim-Philipp Müller <tim.muller at collabora co uk>
|
||||||
|
|
||||||
|
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_start),
|
||||||
|
(gst_neonhttp_src_send_request_and_redirect):
|
||||||
|
Clean up the debug logging code and #ifdef mess a bit: whether or not
|
||||||
|
gstreamer debug messages should be output should not depend on an
|
||||||
|
element property; also, GST_ELEMENT_ERROR will leave a line in the log
|
||||||
|
already, so merge the more useful debug log messages with the less useful
|
||||||
|
error debug strings.
|
||||||
|
|
||||||
2008-09-17 Tim-Philipp Müller <tim.muller at collabora co uk>
|
2008-09-17 Tim-Philipp Müller <tim.muller at collabora co uk>
|
||||||
|
|
||||||
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_start):
|
* ext/neon/gstneonhttpsrc.c: (gst_neonhttp_src_start):
|
||||||
|
|
|
@ -505,26 +505,10 @@ gst_neonhttp_src_start (GstBaseSrc * bsrc)
|
||||||
|
|
||||||
if (res != NE_OK || !src->session) {
|
if (res != NE_OK || !src->session) {
|
||||||
if (res == HTTP_SOCKET_ERROR) {
|
if (res == HTTP_SOCKET_ERROR) {
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
|
||||||
if (src->neon_http_debug) {
|
|
||||||
GST_ERROR_OBJECT (src, "HTTP Request failed when opening socket!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
goto socket_error;
|
goto socket_error;
|
||||||
} else if (res == HTTP_REQUEST_WRONG_PROXY) {
|
} else if (res == HTTP_REQUEST_WRONG_PROXY) {
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
|
||||||
if (src->neon_http_debug) {
|
|
||||||
GST_ERROR_OBJECT (src,
|
|
||||||
"Proxy Server URI is invalid to the HTTP Request!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
goto wrong_proxy;
|
goto wrong_proxy;
|
||||||
} else {
|
} else {
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
|
||||||
if (src->neon_http_debug) {
|
|
||||||
GST_ERROR_OBJECT (src, "HTTP Request failed, error unrecognized!");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
goto begin_req_failed;
|
goto begin_req_failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,20 +575,21 @@ init_failed:
|
||||||
}
|
}
|
||||||
socket_error:
|
socket_error:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
|
||||||
(NULL), ("Could not initialize neon library (%i)", res));
|
("HTTP Request failed when opening socket: %d", res));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
wrong_proxy:
|
wrong_proxy:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS,
|
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
|
||||||
(NULL), ("Both proxy host and port must be specified or none"));
|
("Proxy Server URI is invalid - make sure that either both proxy host "
|
||||||
|
"and port are specified or neither."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
begin_req_failed:
|
begin_req_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
|
GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
|
||||||
(NULL), ("Could not begin request (%i)", res));
|
("Could not begin request: %d", res));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -844,12 +829,8 @@ gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
|
||||||
if (redir != NULL) {
|
if (redir != NULL) {
|
||||||
ne_uri_free (&src->uri);
|
ne_uri_free (&src->uri);
|
||||||
gst_neonhttp_src_set_location (src, redir);
|
gst_neonhttp_src_set_location (src, redir);
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
GST_LOG_OBJECT (src, "Got HTTP Status Code %d", http_status);
|
||||||
if (src->neon_http_debug)
|
GST_LOG_OBJECT (src, "Using 'Location' header [%s]", src->uri.host);
|
||||||
GST_LOG_OBJECT (src,
|
|
||||||
"--> Got HTTP Status Code %d; Using 'Location' header [%s]",
|
|
||||||
http_status, src->uri.host);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -872,17 +853,15 @@ gst_neonhttp_src_send_request_and_redirect (GstNeonhttpSrc * src,
|
||||||
/* if - NE_OK */
|
/* if - NE_OK */
|
||||||
if ((http_status == 302 || http_status == 303) && do_redir) {
|
if ((http_status == 302 || http_status == 303) && do_redir) {
|
||||||
++request_count;
|
++request_count;
|
||||||
GST_WARNING_OBJECT (src, "%s %s.",
|
GST_LOG_OBJECT (src, "redirect request_count is now %d", request_count);
|
||||||
(request_count < MAX_HTTP_REDIRECTS_NUMBER)
|
if (request_count < MAX_HTTP_REDIRECTS_NUMBER && do_redir) {
|
||||||
&& do_redir ? "Redirecting to" :
|
GST_INFO_OBJECT (src, "Redirecting to %s", src->uri.host);
|
||||||
"WILL NOT redirect, try it again with a different URI; an alternative is",
|
} else {
|
||||||
src->uri.host);
|
GST_WARNING_OBJECT (src, "Will not redirect, try again with a "
|
||||||
|
"different URI or redirect location %s", src->uri.host);
|
||||||
|
}
|
||||||
/* FIXME: when not redirecting automatically, shouldn't we post a
|
/* FIXME: when not redirecting automatically, shouldn't we post a
|
||||||
* redirect element message on the bus? */
|
* redirect element message on the bus? */
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
|
||||||
if (src->neon_http_debug)
|
|
||||||
GST_LOG_OBJECT (src, "--> request_count = %d", request_count);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/* 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)
|
||||||
|
|
Loading…
Reference in a new issue