summaryrefslogtreecommitdiffstats
path: root/gst/rtsp/rtspmessage.c
diff options
context:
space:
mode:
authorPeter Kjellerstedt <pkj@axis.com>2007-06-01 13:07:11 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-06-01 13:07:11 +0000
commitf12fb76f70cbc7ecb088fa9ca00b33b3079c9d8e (patch)
treec051ea88aa8b4d42eaf9ea6169f75cd983ef2084 /gst/rtsp/rtspmessage.c
parent89ae9b40f9c32d3e8aac4c7c9aafb83d64fa2497 (diff)
gst/rtsp/: Improves version checking, allowing an RTSP server to reply with "505
Original commit message from CVS: Patch by: Peter Kjellerstedt <pkj at axis com> * gst/rtsp/rtspconnection.c: (rtsp_connection_create), (rtsp_connection_connect), (add_date_header), (rtsp_connection_send), (parse_response_status), (parse_request_line), (parse_line), (rtsp_connection_receive): * gst/rtsp/rtspdefs.c: (rtsp_version_as_text): * gst/rtsp/rtspdefs.h: * gst/rtsp/rtspmessage.c: (key_value_foreach), (rtsp_message_init_request), (rtsp_message_init_response), (rtsp_message_remove_header), (rtsp_message_append_headers), (rtsp_message_dump): * gst/rtsp/rtspmessage.h: Improves version checking, allowing an RTSP server to reply with "505 RTSP Version not supported. Adds a Date header to all messages. Replies with RTSP_EPARSE rather than RTSP_EINVALID in cases where we want to be able to send a response even if something in the request was invalid. EINVAL is only used when passing wrong arguments to functions. Do not handle an invalid method in parse_request_line(). Defer this to the caller so it can respond with "405 Method Not Allowed". Improves parsing of the timeout parameter to the Session header, allowing whitespace after the semicolon. Avoids a compiler warning due to variables shadowing a function argument.
Diffstat (limited to 'gst/rtsp/rtspmessage.c')
-rw-r--r--gst/rtsp/rtspmessage.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gst/rtsp/rtspmessage.c b/gst/rtsp/rtspmessage.c
index 2cb12bf3..5dd2faab 100644
--- a/gst/rtsp/rtspmessage.c
+++ b/gst/rtsp/rtspmessage.c
@@ -118,6 +118,7 @@ rtsp_message_init_request (RTSPMessage * msg, RTSPMethod method,
msg->type = RTSP_MESSAGE_REQUEST;
msg->type_data.request.method = method;
msg->type_data.request.uri = g_strdup (uri);
+ msg->type_data.request.version = RTSP_VERSION_1_0;
msg->hdr_fields = g_array_new (FALSE, FALSE, sizeof (RTSPKeyValue));
return RTSP_OK;
@@ -152,6 +153,7 @@ rtsp_message_init_response (RTSPMessage * msg, RTSPStatusCode code,
msg->type = RTSP_MESSAGE_RESPONSE;
msg->type_data.response.code = code;
msg->type_data.response.reason = g_strdup (reason);
+ msg->type_data.response.version = RTSP_VERSION_1_0;
msg->hdr_fields = g_array_new (FALSE, FALSE, sizeof (RTSPKeyValue));
if (request) {
@@ -424,9 +426,11 @@ rtsp_message_dump (RTSPMessage * msg)
case RTSP_MESSAGE_REQUEST:
g_print ("RTSP request message %p\n", msg);
g_print (" request line:\n");
- g_print (" method: '%s'\n",
+ g_print (" method: '%s'\n",
rtsp_method_as_text (msg->type_data.request.method));
- g_print (" uri: '%s'\n", msg->type_data.request.uri);
+ g_print (" uri: '%s'\n", msg->type_data.request.uri);
+ g_print (" version: '%s'\n",
+ rtsp_version_as_text (msg->type_data.request.version));
g_print (" headers:\n");
key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
g_print (" body:\n");
@@ -436,8 +440,10 @@ rtsp_message_dump (RTSPMessage * msg)
case RTSP_MESSAGE_RESPONSE:
g_print ("RTSP response message %p\n", msg);
g_print (" status line:\n");
- g_print (" code: '%d'\n", msg->type_data.response.code);
- g_print (" reason: '%s'\n", msg->type_data.response.reason);
+ g_print (" code: '%d'\n", msg->type_data.response.code);
+ g_print (" reason: '%s'\n", msg->type_data.response.reason);
+ g_print (" version: '%s'\n",
+ rtsp_version_as_text (msg->type_data.response.version));
g_print (" headers:\n");
key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
rtsp_message_get_body (msg, &data, &size);