Skip to content

[WebServer] ERR_CONNECTION_RESET on multiple requests #10736

Closed
@TD-er

Description

@TD-er

Version

latest master (checkout manually)

Description

Lately there have been issues with handling multiple requests to the webserver shortly after eachother.

For example loading CSS as a separate call or handling a GET and then a POST or when authenticating using a script.

It appears _sse is not always initialized in NetworkClient:

NetworkClient::NetworkClient() : _rxBuffer(nullptr), _connected(false), _sse(false), _timeout(WIFI_CLIENT_DEF_CONN_TIMEOUT_MS), next(NULL) {}
NetworkClient::NetworkClient(int fd) : _connected(true), _timeout(WIFI_CLIENT_DEF_CONN_TIMEOUT_MS), next(NULL) {
clientSocketHandle.reset(new NetworkClientSocketHandle(fd));
_rxBuffer.reset(new NetworkClientRxBuffer(fd));
}

And the declaration of the members (without initialization):

class NetworkClient : public ESPLwIPClient {
protected:
std::shared_ptr<NetworkClientSocketHandle> clientSocketHandle;
std::shared_ptr<NetworkClientRxBuffer> _rxBuffer;
bool _connected;
bool _sse;
int _timeout;
int _lastWriteTimeout;
int _lastReadTimeout;

Suggested fix:

in NetworkClient.h:

class NetworkClient : public ESPLwIPClient {
protected:
  std::shared_ptr<NetworkClientSocketHandle> clientSocketHandle = nullptr;
  std::shared_ptr<NetworkClientRxBuffer> _rxBuffer = nullptr;
  bool _connected = false;
  bool _sse = false;
  int _timeout;
  int _lastWriteTimeout = 0;
  int _lastReadTimeout = 0;

Not only _sse is not always initialized, there are other members too.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions