<div>hi, everybody:</div><div> </div><div>the function ff_rtsp_parse_line imported from avformat.dll can't parse anything while the line is correct. for example: when line is "Session: xxxxxxxxxxxxxxxxxxx", then call ff_rtsp_parse_line(header, line, NULL, NULL), after that, the result is header->session_id == "".</div><div> </div><div>int CAVServerImpl::rtsp_parse_request(HTTPContext *c)<br>{<br> const char *p, *p1, *p2;<br> char cmd[32];<br> char url[1024];<br> char protocol[32];<br> char line[1024];<br> int len;<br> RTSPMessageHeader header1 = { 0 }, *header = &header1;</div><div> c->buffer_ptr[0] = '\0';<br> p = (const char *)c->buffer;</div><div> get_word(cmd, sizeof(cmd), &p);<br> get_word(url, sizeof(url), &p);<br> get_word(protocol, sizeof(protocol), &p);</div><div> av_strlcpy(c->method, cmd, sizeof(c->method));<br> av_strlcpy(c->url, url, sizeof(c->url));<br> av_strlcpy(c->protocol, protocol, sizeof(c->protocol));</div><div> if (avio_open_dyn_buf(&c->pb) < 0) {<br>  /* XXX: cannot do more */<br>  c->pb = NULL; /* safety */<br>  return -1;<br> }</div><div> /* check version name */<br> if (strcmp(protocol, "RTSP/1.0") != 0) {<br>  rtsp_reply_error(c, RTSP_STATUS_VERSION);<br>  goto the_end;<br> }</div><div> /* parse each header line */<br> memset(header, 0, sizeof(*header));<br> /* skip to next line */<br> while (*p != '\n' && *p != '\0')<br>  p++;<br> if (*p == '\n')<br>  p++;<br> while (*p != '\0') {<br>  p1 = (const char *)memchr(p, '\n', (char *)c->buffer_ptr - p);<br>  if (!p1)<br>   break;<br>  p2 = p1;<br>  if (p2 > p && p2[-1] == '\r')<br>   p2--;<br>  /* skip empty line */<br>  if (p2 == p)<br>   break;<br>  len = p2 - p;<br>  if (len > sizeof(line) - 1)<br>   len = sizeof(line) - 1;<br>  memcpy(line, p, len);<br>  line[len] = '\0';<br>  ff_rtsp_parse_line(header, line, NULL, NULL);     // XXXXXXXXXXXXXXXXXXXXXXXX THIS IS NOT CORRECT !!!<br>  p = p1 + 1;<br> }</div><div> /* handle sequence number */<br> c->seq = header->seq;</div><div> if (!strcmp(cmd, "DESCRIBE"))<br>  rtsp_cmd_describe(c, url);<br> else if (!strcmp(cmd, "OPTIONS"))<br>  rtsp_cmd_options(c, url);<br> else if (!strcmp(cmd, "SETUP"))<br>  rtsp_cmd_setup(c, url, header);<br> else if (!strcmp(cmd, "PLAY"))<br>  rtsp_cmd_play(c, url, header);<br> else if (!strcmp(cmd, "PAUSE"))<br>  rtsp_cmd_pause(c, url, header);<br> else if (!strcmp(cmd, "TEARDOWN"))<br>  rtsp_cmd_teardown(c, url, header);<br> else<br>  rtsp_reply_error(c, RTSP_STATUS_METHOD);</div><div>the_end:<br> len = avio_close_dyn_buf(c->pb, &c->pb_buffer);<br> c->pb = NULL; /* safety */<br> if (len < 0) {<br>  /* XXX: cannot do more */<br>  return -1;<br> }<br> c->buffer_ptr = c->pb_buffer;<br> c->buffer_end = c->pb_buffer + len;<br> c->state = RTSPSTATE_SEND_REPLY;<br> return 0;<br>}</div>