[Live-devel] RTSP response status codes: 403 Forbidden

Maxim P. DEMENTIEV maxim.dementiev at nexvision.fr
Tue Dec 8 00:50:08 PST 2015


Thank you very much, Ross!

I think it is possible to do a patch which will not break the old
behaviour and let other replies.
(And I personally have no doubt that you know better than me how to do
it; just as a proposal...)

Say, in the header we add another virtual method with the string as a
return value:

  // if there is some problem,
  // returns the status code in the form "4XX Message text",
  // otherwise NULL
  virtual const char * specialClientAccessCheck_ext(int clientSocket,
struct sockaddr_in& clientAddr,
                       char const* urlSuffix);

Then to change the old method usage:

Boolean RTSPServer::RTSPClientConnection
::authenticationOK(char const* cmdName, char const* urlSuffix, char
const* fullRequestStr) {

  if (const char * resp =
fOurServer.specialClientAccessCheck_ext(fClientInputSocket, fClientAddr,
urlSuffix)) {
    setRTSPResponse(resp);
    return False;
  }

And to implement the new virtual method without breaking old behaviour:

const char * RTSPServer
::specialClientAccessCheck_ext(int /*clientSocket*/, struct sockaddr_in&
/*clientAddr*/, char const* /*urlSuffix*/) {
  // default implementation
  return specialClientAccessCheck(clientSocket, clientAddr, urlSuffix) ?
NULL : "401 Unauthorized";
}

Of course, if we want a more general behaviour, we need to add some mime
fields for a response.
In this case, the return value of the new method must be more complicated.

Regards,
Max

On 12/08/2015 08:45 AM, Ross Finlayson wrote:
> Our server code currently has no mechanism for specifying an ‘authentication failed’ response other than “401 Unauthorized”.
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel



More information about the live-devel mailing list