ArduinoMongoose icon indicating copy to clipboard operation
ArduinoMongoose copied to clipboard

HTTP API oddity

Open ianrrees opened this issue 3 years ago • 0 comments
trafficstars

I'm not sure if this is actually a problem, but wanted to make a note to look at this before finishing up with the Mongoose 7.7 upgrade.

In the static MongooseHttpClient::eventHandler(), the requests's MongooseHttpClientRequest::_client field is used to reference back to the client associated with the request. But, that _client field is only set in the MongooseHttpClientRequest ctor, and it's not checked in MongooseHttpClient::send(). It might be possible for a request to be sent through a different client than it was originally constructed with. Not sure if that's really a problem, but it seems like a potential source of weird bugs.

One fix might be to move the public send() method over to the request, since it already has an associated client.

ianrrees avatar Nov 19 '22 21:11 ianrrees