Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'class AsyncServer' has no member named 'beginSecure' #392

Closed
eliasmagn opened this issue Aug 2, 2018 · 4 comments
Closed

'class AsyncServer' has no member named 'beginSecure' #392

eliasmagn opened this issue Aug 2, 2018 · 4 comments
Labels

Comments

@eliasmagn
Copy link

eliasmagn commented Aug 2, 2018

Cant compile with beginSecure!

#include <ESP8266WiFi.h>
 #include <FS.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include "SD.h"
#include "user_interface.h"
#include <DNSServer.h>
#define ASYNC_TCP_SSL_ENABLED
AsyncWebServer server(80);
AsyncWebServer httpsserver(443);
.
.
.
.
  server.begin();
  httpsserver.beginSecure("/server.cer", "/server.key", NULL);

nore error: 'class AsyncWebServer' has no member named 'onSslFileRequest'

  request->redirect("/index.htm");
//drawGraph(request);
  });


  httpsserver.onSslFileRequest([](void * arg, const char *filename, uint8_t **buf) -> int {
    Serial.printf("SSL File: %s\n", filename);
    File file = SPIFFS.open(filename, "r");
    if(file){
      size_t size = file.size();
      uint8_t * nbuf = (uint8_t*)malloc(size);
      if(nbuf){
        size = file.read(nbuf, size);
        file.close();
        *buf = nbuf;
        return size;
      }
      file.close();
    }
    *buf = 0;
    return 0;
  }, NULL);

  httpsserver.onNotFound([](AsyncWebServerRequest *request){

Any ideas or a hint?
I am using programio with latest libs!
thx in advance!

@stale
Copy link

stale bot commented Sep 21, 2019

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 21, 2019
@stale
Copy link

stale bot commented Oct 5, 2019

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@jsonpoindexter
Copy link

@eliasmagn ASYNC_TCP_SSL_ENABLED needs to be declared before the imports of ESPAsyncTCP and ESPAsyncWebServer like so:

#define ASYNC_TCP_SSL_ENABLED true
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>

@eliasmagn
Copy link
Author

eliasmagn commented Apr 19, 2020

@jsonpoindexter
Nice! I hardcoded this somehow back then. But this was ugly. How easy it could have been wouldnt i have stopped thinking about... Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants