From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Fri, 22 Oct 2021 18:36:31 +0000 (+0100) Subject: Return 501 "Not Implemented" for unexpected RTSP commands -- it seems to work better... X-Git-Tag: 4.1-rc1~24^2~389 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2e35fc02ed7cf74a99e0715476a9f3399158250;p=thirdparty%2Fshairport-sync.git Return 501 "Not Implemented" for unexpected RTSP commands -- it seems to work better. The old code, 400, didn't seem to get the required response. --- diff --git a/rtsp.c b/rtsp.c index 56ac5b3c..0135aaa5 100644 --- a/rtsp.c +++ b/rtsp.c @@ -1303,7 +1303,7 @@ int msg_write_response(rtsp_conn_info *conn, rtsp_message *resp) { char *string; }; - struct response_t responses[] = {{200, "OK"}, {400, "Bad Request"}, {403, "Unauthorized"}}; + struct response_t responses[] = {{200, "OK"}, {400, "Bad Request"}, {403, "Unauthorized"}, {501, "Not Implemented"}}; int found = 0; char *respcode_text = "Unauthorized"; for (i = 0; i < sizeof(responses) / sizeof(struct response_t); i++) { @@ -4620,7 +4620,7 @@ static void *rtsp_conversation_thread_func(void *pconn) { pthread_cleanup_push(msg_cleanup_function, (void *)&req); resp = msg_init(); pthread_cleanup_push(msg_cleanup_function, (void *)&resp); - resp->respcode = 400; + resp->respcode = 501; // Not Implemented /* if (strcmp(req->method, "OPTIONS") != 0) // the options message is very common, so don't log it until level 3 @@ -4661,7 +4661,7 @@ static void *rtsp_conversation_thread_func(void *pconn) { } } if (method_selected == 0) { - debug(1, "Connection %d: Unrecognised and unhandled rtsp request \"%s\".", + debug(1, "Connection %d: Unrecognised and unhandled rtsp request \"%s\". HTTP Response Code 501 (\"Not Implemented\") returned.", conn->connection_number, req->method); int y = req->contentlength; @@ -4680,6 +4680,7 @@ static void *rtsp_conversation_thread_func(void *pconn) { *obfp = 0; debug(1, "Content: \"%s\".", obf); } + } } debug(debug_level, "Connection %d: RTSP Response:", conn->connection_number);