boblemaire / asyncHTTPrequest

asynchronous HTTP for ESP using ESPasyncTCP. Works like XMLHTTPrequest in JS.
GNU General Public License v3.0
65 stars 31 forks source link

Following redirects? #34

Closed Nightsd01 closed 3 years ago

Nightsd01 commented 3 years ago

I am a bit of a n00b when it comes to the fundamental principles of how the HTTP protocol works in depth.

When I receive a 301 redirect response, how should I handle this? Should I close the existing request and allocate a new request using the new location URL? Or is there an easier/better way to do it?

I am thinking about making a PR to add an option for automatically following redirects but I am not sure of the best approach

boblemaire commented 3 years ago

I'd recommend you pursue the redirect URL at your level rather than blindly follow the instruction in asyncHTTPrequest. A common redirect is to require HTTPS in response to a HTTP request. asyncHTTPrequest cannot do that. I hope that helps, I'm going to close this.