comparison rtsp.c @ 6157:f403b7c0e51b libavformat

RTSP: Use the same authentication for the HTTP POST session as for the GET
author mstorsjo
date Mon, 21 Jun 2010 19:41:02 +0000
parents 06766607951e
children 72ea866c62fd
comparison
equal deleted inserted replaced
6156:85710c0ef275 6157:f403b7c0e51b
1614 "Expires: Sun, 9 Jan 1972 00:00:00 GMT\r\n", 1614 "Expires: Sun, 9 Jan 1972 00:00:00 GMT\r\n",
1615 sessioncookie); 1615 sessioncookie);
1616 ff_http_set_headers(rt->rtsp_hd_out, headers); 1616 ff_http_set_headers(rt->rtsp_hd_out, headers);
1617 ff_http_set_chunked_transfer_encoding(rt->rtsp_hd_out, 0); 1617 ff_http_set_chunked_transfer_encoding(rt->rtsp_hd_out, 0);
1618 1618
1619 /* Initialize the authentication state for the POST session. The HTTP
1620 * protocol implementation doesn't properly handle multi-pass
1621 * authentication for POST requests, since it would require one of
1622 * the following:
1623 * - implementing Expect: 100-continue, which many HTTP servers
1624 * don't support anyway, even less the RTSP servers that do HTTP
1625 * tunneling
1626 * - sending the whole POST data until getting a 401 reply specifying
1627 * what authentication method to use, then resending all that data
1628 * - waiting for potential 401 replies directly after sending the
1629 * POST header (waiting for some unspecified time)
1630 * Therefore, we copy the full auth state, which works for both basic
1631 * and digest. (For digest, we would have to synchronize the nonce
1632 * count variable between the two sessions, if we'd do more requests
1633 * with the original session, though.)
1634 */
1635 ff_http_init_auth_state(rt->rtsp_hd_out, rt->rtsp_hd);
1636
1619 } else { 1637 } else {
1620 /* open the tcp connection */ 1638 /* open the tcp connection */
1621 ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL); 1639 ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
1622 if (url_open(&rt->rtsp_hd, tcpname, URL_RDWR) < 0) { 1640 if (url_open(&rt->rtsp_hd, tcpname, URL_RDWR) < 0) {
1623 err = AVERROR(EIO); 1641 err = AVERROR(EIO);