- /* */
- str = g_strdup_printf ("POST %s%s%s%s%s%s HTTP/1.0\r\n"
- "%s"
- "x-sessioncookie: %s\r\n"
- "Content-Type: application/x-rtsp-tunnelled\r\n"
- "Pragma: no-cache\r\n"
- "Cache-Control: no-cache\r\n"
- "Content-Length: 32767\r\n"
- "Expires: Sun, 9 Jan 1972 00:00:00 GMT\r\n"
- "\r\n",
- conn->proxy_host ? "http://" : "",
- conn->proxy_host ? url->host : "",
- conn->proxy_host ? url_port_str : "",
- url->abspath, url->query ? "?" : "", url->query ? url->query : "",
- hostparam ? hostparam : "", conn->tunnelid);
-
- res = gst_rtsp_connection_write (conn, (guint8 *) str, strlen (str), timeout);
- g_free (str);
- if (res != GST_RTSP_OK)
- goto write_failed;
+ /* create the POST request for the write connection */
+ GST_RTSP_CHECK (gst_rtsp_message_new_request (&msg, GST_RTSP_POST, uri),
+ no_message);
+ msg->type = GST_RTSP_MESSAGE_HTTP_REQUEST;
+
+ if (hostparam != NULL)
+ gst_rtsp_message_add_header (msg, GST_RTSP_HDR_HOST, hostparam);
+ gst_rtsp_message_add_header (msg, GST_RTSP_HDR_X_SESSIONCOOKIE,
+ conn->tunnelid);
+ gst_rtsp_message_add_header (msg, GST_RTSP_HDR_ACCEPT,
+ "application/x-rtsp-tunnelled");
+ gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CACHE_CONTROL, "no-cache");
+ gst_rtsp_message_add_header (msg, GST_RTSP_HDR_PRAGMA, "no-cache");
+ gst_rtsp_message_add_header (msg, GST_RTSP_HDR_EXPIRES,
+ "Sun, 9 Jan 1972 00:00:00 GMT");
+ gst_rtsp_message_add_header (msg, GST_RTSP_HDR_CONTENT_LENGTH, "32767");
+
+ /* we need to temporarily set conn->tunneled to FALSE to prevent the HTTP
+ * request from being base64 encoded */
+ conn->tunneled = FALSE;
+ GST_RTSP_CHECK (gst_rtsp_connection_send (conn, msg, timeout), write_failed);
+ gst_rtsp_message_free (msg);
+ conn->tunneled = TRUE;