Skip to content

WebServer: Make it possible to create and use derived classes #11944

@hurricanefrog

Description

@hurricanefrog

Related area

WebServer

Hardware specification

Doesn't matter

Is your feature request related to a problem?

In the WebServer class, void WebServer::sendContent_P(PGM_P content, size_t size) is not virtual, i.e.. not overridable. However, its implementation uses _currentClient. That makes it impossible to implement a derived class, e.g. to implement a TLS-protected SecureWebServer. For that, I'd have to use a SecureClient member.

At least that applies when I want to do "proper polymorphism", i.e. access my potential SecureWebServer via a WebServer pointer.

Describe the solution you'd like

  • Make all methods using _currentClient virtual
  • Alternatively, make use of the client() virtual method consistently?

Describe alternatives you've considered

No response

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions