[erlang-questions] inet:setopts({packet, http}) for RTSP

Sverker Eriksson <>
Mon Nov 16 09:40:07 CET 2009


Max Lapshin wrote:
> Hi, I want to get data from QuickTime Broadcaster. This tool uses RTSP
> protocol (http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol)
>
> This protocol seems to look like HTTP, but with other verbs. Here is example:
>
> ANNOUNCE rtsp://maxbook.local:8000/mystream.sdp RTSP/1.0\r\n
>
> I wanted to utilize http mode of socket, thinking that it will parse
> RTSP requests, but now it seems to be impossible.
> I understand, that it is unacceptable to atomify user input strings
> ("ANNOUNCE" -> announce), but is it the only reason not to parse it?
>
>   
It works if you change "RTSP" to "HTTP" :-)

1> Bin = <<"ANNOUNCE rtsp://maxbook.local:8000/mystream.sdp HTTP/1.0\r\n">>.
2> erlang:decode_packet(http,Bin,[]).
{ok,{http_request,"ANNOUNCE",
                  {scheme,"rtsp","//maxbook.local:8000/mystream.sdp"},
                  {1,0}},
    <<>>}

The parsing is done in erts/emulator/beam/packet_parser.c: 
packet_parse_http()


/Sverker, Erlang/OTP Ericsson



More information about the erlang-questions mailing list