SmittyWerben#1
Member
Hi folks!
I'm using AsyncWebServer_Teensy41 to present a few different server pages, set up very much simplified in the code below (my pages are more dynamic, but this demonstrates a simple case.) I've got some scripts that are reading from these pages asynchronously. I find that they chug along pretty well until I point a browser at it and refresh any one of these pages by hand, then I get a continuous series of errors that wireshark is calling "Continuation" issues.
Once the Continuation is seen, my parser on the client complains "Invoke-WebRequest : The server committed a protocol violation. Section=ResponseStatusLine"
Looking at a successful vs. a failed transfer, I notice this: The "HTTP/1.1" is missing from the malformed transfer.
I've tried setting up the code to use the multiserver approach and it seems a bit better hardened against this, but I can still eventually make it fail.
Am I getting into trouble with multiple open connections? Do I need to close the connection myself? Do I need to somehow gate this transfers on completeness?
Should I drop down into the lwip level and do this all using sockets instead?
Thanks in advance for your questions and suggestions!
I'm using AsyncWebServer_Teensy41 to present a few different server pages, set up very much simplified in the code below (my pages are more dynamic, but this demonstrates a simple case.) I've got some scripts that are reading from these pages asynchronously. I find that they chug along pretty well until I point a browser at it and refresh any one of these pages by hand, then I get a continuous series of errors that wireshark is calling "Continuation" issues.
Once the Continuation is seen, my parser on the client complains "Invoke-WebRequest : The server committed a protocol violation. Section=ResponseStatusLine"
Looking at a successful vs. a failed transfer, I notice this: The "HTTP/1.1" is missing from the malformed transfer.
I've tried setting up the code to use the multiserver approach and it seems a bit better hardened against this, but I can still eventually make it fail.
Am I getting into trouble with multiple open connections? Do I need to close the connection myself? Do I need to somehow gate this transfers on completeness?
Should I drop down into the lwip level and do this all using sockets instead?
Thanks in advance for your questions and suggestions!
C++:
void setup_http()
{
server.onNotFound(handleNotFound);
// register a "directory" of available pages to be shown on /
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
{
String html = "Here's my root directory";
request->send(200, "text/html", html); });
// register the OTA update page on /firmware: args are (URI, method, onRequest)
server.on("/firmware", HTTP_GET, [](AsyncWebServerRequest *request)
{
String html = "<body><h1>firmware update</h1><br>"
"<h2>select and send your binary file:</h2><br>"
"<div><form method='POST' enctype='multipart/form-data' action='/firmware'>"
"<input type='file' name='file'><button type='submit'>Send</button>"
"</form></div></body>";
request->send(200, "text/html", html); });
server.on("/firmware", HTTP_POST, OTAend, OTA);
server.on("/data", HTTP_GET, [](AsyncWebServerRequest *request)
{
String html = "Here's my data directory";
request->send(200, "text/html", html); });
server.begin();
}