rtsp: Include an User-Agent header field in all requests

Message ID 1373620725-18922-1-git-send-email-martin@martin.st
State Committed
Commit 1dd1b2332ebbac710d8e0214cec7595e118f2105
Headers show

Commit Message

Martin Storsjö July 12, 2013, 9:18 a.m.
Some rtsp servers like the IP Cam IcyBox IB-CAM2002 need it.

Based on a patch by Carl Eugen Hoyos.
---
Hopefully including this in the requests doesn't break other
picky servers.
---
 libavformat/rtsp.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Luca Barbato July 12, 2013, 9:55 a.m. | #1
On 07/12/2013 11:18 AM, Martin Storsjö wrote:
> Some rtsp servers like the IP Cam IcyBox IB-CAM2002 need it.
> 
> Based on a patch by Carl Eugen Hoyos.
> ---
> Hopefully including this in the requests doesn't break other
> picky servers.

Patch ok, if the need arises we can add an avoption to change the string
or disable it.

lu

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 761aa11..29ef403 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1133,6 +1133,7 @@  static int rtsp_send_cmd_with_content_async(AVFormatContext *s,
     if (headers)
         av_strlcat(buf, headers, sizeof(buf));
     av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", rt->seq);
+    av_strlcatf(buf, sizeof(buf), "User-Agent: %s\r\n", LIBAVFORMAT_IDENT);
     if (rt->session_id[0] != '\0' && (!headers ||
         !strstr(headers, "\nIf-Match:"))) {
         av_strlcatf(buf, sizeof(buf), "Session: %s\r\n", rt->session_id);