← Commit list

cdbe4eb556

Stephen Psaradellis
Stephen Psaradellis
2026-09-15
SUCCESS Duration: 384s

Subject

rtsp: do not read a response body when CURLOPT_NOBODY is set

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/http.c+3 -2
@@ -4213,9 +4213,10 @@ static CURLcode http_on_response(struct Curl_easy *data,
#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. */
+ treating it as excess data, unless the application asked for no body
+ with CURLOPT_NOBODY. */
if((conn->scheme->protocol & CURLPROTO_RTSP) && data->req.no_body &&
- (k->size > 0))
+ !data->set.opt_no_body && (k->size > 0))
data->req.no_body = FALSE;
#endif
tests/data/Makefile.am+1 -0
@@ -1706,6 +1706,7 @@ TESTCASES = \
test1685 \
test1686 \
test1687 \
+ test1688 \
\
test1700 \
test1702 \
tests/data/test1688+57 -0
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<testcase>
+<info>
+<keywords>
+RTSP
+OPTIONS
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<data nocheck="yes">
+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, CURLOPT_NOBODY set
+</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
+
+</stdout>
+</verify>
+</testcase>
tests/libtest/lib567.c+2 -0
@@ -53,6 +53,8 @@ static CURLcode test_lib567(const char *URL)
easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, URL);
easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
easy_setopt(curl, CURLOPT_USERAGENT, "test567");
+ if(testnum == 1688)
+ easy_setopt(curl, CURLOPT_NOBODY, 1L);
custom_headers = curl_slist_append(custom_headers, "Test-Number: 567");
easy_setopt(curl, CURLOPT_RTSPHEADER, custom_headers);