rtsp: accept a Content-Length body on methods that expected none
No binary (build failed)
—
(log yok)
| @@ -490,13 +490,3 @@ See https://curl.se/mail/lib-2024-05/0026.html and | |
| The transfer ends with error "QUIC connection is draining". | |
| [curl issue 12037](https://github.com/curl/curl/issues/12037) | |
| - | |
| - | # RTSP |
| - | |
| - | ## Some methods do not support response bodies |
| - | |
| - | The RTSP implementation is written to assume that a number of RTSP methods |
| - | always get responses without bodies, even though there seems to be no |
| - | indication in the RFC that this is always the case. |
| - | |
| - | [curl issue 12414](https://github.com/curl/curl/issues/12414) |
| @@ -4210,6 +4210,15 @@ static CURLcode http_on_response(struct Curl_easy *data, | |
| if(result) | |
| goto out; | |
| + | #ifndef CURL_DISABLE_RTSP |
| + | /* An RTSP response to any method may carry a body, which is announced |
| + | with Content-Length (RFC 2326 section 12.14). Read it instead of |
| + | treating it as excess data. */ |
| + | if((conn->scheme->protocol & CURLPROTO_RTSP) && data->req.no_body && |
| + | (k->size > 0)) |
| + | data->req.no_body = FALSE; |
| + | #endif |
| + | |
| /* If we requested a "no body", this is a good time to get | |
| * out and return home. | |
| */ | |
| @@ -676,6 +676,7 @@ TESTCASES = \ | |
| test654 \ | |
| test655 \ | |
| test656 \ | |
| + | test657 \ |
| test658 \ | |
| test659 \ | |
| test660 \ | |
| @@ -0,0 +1,58 @@ | |
| + | <?xml version="1.0" encoding="US-ASCII"?> |
| + | <testcase> |
| + | <info> |
| + | <keywords> |
| + | RTSP |
| + | OPTIONS |
| + | </keywords> |
| + | </info> |
| + | |
| + | # Server-side |
| + | <reply> |
| + | <data> |
| + | RTSP/1.0 200 OK |
| + | Server: RTSPD/libcurl-test |
| + | CSeq: 1 |
| + | Public: DESCRIBE, OPTIONS, SETUP, TEARDOWN, PLAY, PAUSE |
| + | Content-Length: 18 |
| + | |
| + | No-More: sessions |
| + | </data> |
| + | </reply> |
| + | |
| + | # Client-side |
| + | <client> |
| + | <server> |
| + | rtsp |
| + | </server> |
| + | <tool> |
| + | lib567 |
| + | </tool> |
| + | <name> |
| + | RTSP OPTIONS response with a body |
| + | </name> |
| + | <command> |
| + | rtsp://%HOSTIP:%RTSPPORT/%TESTNUMBER |
| + | </command> |
| + | </client> |
| + | |
| + | # Verify data after the test has been "shot" |
| + | <verify> |
| + | <protocol crlf="headers"> |
| + | OPTIONS rtsp://%HOSTIP:%RTSPPORT/%TESTNUMBER RTSP/1.0 |
| + | CSeq: 1 |
| + | User-Agent: test567 |
| + | Test-Number: 567 |
| + | |
| + | </protocol> |
| + | <stdout> |
| + | RTSP/1.0 200 OK |
| + | Server: RTSPD/libcurl-test |
| + | CSeq: 1 |
| + | Public: DESCRIBE, OPTIONS, SETUP, TEARDOWN, PLAY, PAUSE |
| + | Content-Length: 18 |
| + | |
| + | No-More: sessions |
| + | </stdout> |
| + | </verify> |
| + | </testcase> |