Skip to content

Commit f69fffc

Browse files
committed
Reorganize repository as Arduino library
1 parent 7346398 commit f69fffc

40 files changed

+160
-134
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ Release/
4949
.scala_dependencies
5050
.worksheet
5151

52-
data/wifi/wifi.h
53-
data/cert/*.h
52+
examples/wifi/wifi.h
53+
examples/cert/*.h
File renamed without changes.
File renamed without changes.

tools/cert/create_cert.sh renamed to extras/create_cert.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ openssl rsa -in example.key -outform DER -out example.key.DER
5555
openssl x509 -in example.crt -outform DER -out example.crt.DER
5656

5757
# create header files
58-
mkdir ../../data/cert
59-
xxd -i example.crt.DER > ../../data/cert/cert.h
60-
xxd -i example.key.DER > ../../data/cert/private_key.h
58+
mkdir ../examples/cert
59+
xxd -i example.crt.DER > ../examples/cert/cert.h
60+
xxd -i example.key.DER > ../examples/cert/private_key.h

https_server.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
#include "data/favicon.h"
3333

3434
// Inlcudes for setting up the server
35-
#include "https/HTTPSServer.hpp"
35+
#include "src/HTTPSServer.hpp"
3636

3737
// Includes to define request handler callbacks
38-
#include "https/HTTPRequest.hpp"
39-
#include "https/HTTPResponse.hpp"
38+
#include "src/HTTPRequest.hpp"
39+
#include "src/HTTPResponse.hpp"
4040

4141
// The server loop will be configured as a separate task, so the server will run
4242
// independently from all other code.

keywords.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ConnectionContext KEYWORD1
2+
HTTPConnection KEYWORD1
3+
HTTPHeader KEYWORD1
4+
HTTPHeaders KEYWORD1
5+
HTTPMiddlewareFunction KEYWORD1
6+
HTTPRequest KEYWORD1
7+
HTTPResponse KEYWORD1
8+
HTTPSCallbackFunction KEYWORD1
9+
HTTPSConnection KEYWORD1
10+
HTTPServer KEYWORD1
11+
HTTPSServer KEYWORD1
12+
ResolvedResource KEYWORD1
13+
ResourceNode KEYWORD1
14+
ResourceParameters KEYWORD1
15+
ResourceResolver KEYWORD1
16+
SSLCert KEYWORD1

library.properties

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name=ESP32 HTTP(S) Webserver
2+
version=0.1.0
3+
author=Frank Hessel <[email protected]>
4+
maintainer=Frank Hessel <[email protected]>
5+
sentence=SSL/TLS-enabled HTTPS server library for the ESP32.
6+
paragraph=The library allows to define handler functions for specific request URLs, provides some help with the HTTP protocol. It can handle unencrypted HTTP traffic as well.
7+
category=Communication
8+
url=https://github.com/fhessel/esp32_https_server
9+
architectures=esp32
10+
includes=HTTPSServer.hpp,HTTPRequest.hpp,HTTPResponse.hpp

https/ConnectionContext.cpp renamed to src/ConnectionContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: frank
66
*/
77

8-
#include "ConnectionContext.hpp"
8+
#include "../src/ConnectionContext.hpp"
99

1010
namespace httpsserver {
1111

https/ConnectionContext.hpp renamed to src/ConnectionContext.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Author: frank
66
*/
77

8-
#ifndef HTTPS_CONNECTIONCONTEXT_HPP_
9-
#define HTTPS_CONNECTIONCONTEXT_HPP_
8+
#ifndef SRC_CONNECTIONCONTEXT_HPP_
9+
#define SRC_CONNECTIONCONTEXT_HPP_
1010

1111
#include <Arduino.h>
1212

@@ -35,4 +35,4 @@ class ConnectionContext {
3535

3636
} /* namespace httpsserver */
3737

38-
#endif /* HTTPS_CONNECTIONCONTEXT_HPP_ */
38+
#endif /* SRC_CONNECTIONCONTEXT_HPP_ */

https/HTTPConnection.cpp renamed to src/HTTPConnection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "HTTPConnection.hpp"
1+
#include "../src/HTTPConnection.hpp"
22

33
namespace httpsserver {
44

https/HTTPConnection.hpp renamed to src/HTTPConnection.hpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef HTTPS_HTTPCONNECTION_HPP_
2-
#define HTTPS_HTTPCONNECTION_HPP_
1+
#ifndef SRC_HTTPCONNECTION_HPP_
2+
#define SRC_HTTPCONNECTION_HPP_
33

44
#include <Arduino.h>
55

@@ -11,14 +11,14 @@
1111
#undef read
1212
#include "lwip/sockets.h"
1313

14-
#include "HTTPSServerConstants.hpp"
15-
#include "HTTPHeaders.hpp"
16-
#include "HTTPHeader.hpp"
17-
#include "ResourceResolver.hpp"
18-
#include "ResolvedResource.hpp"
19-
#include "ResourceNode.hpp"
20-
#include "HTTPRequest.hpp"
21-
#include "HTTPResponse.hpp"
14+
#include "../src/HTTPSServerConstants.hpp"
15+
#include "../src/HTTPHeaders.hpp"
16+
#include "../src/HTTPHeader.hpp"
17+
#include "../src/ResourceResolver.hpp"
18+
#include "../src/ResolvedResource.hpp"
19+
#include "../src/ResourceNode.hpp"
20+
#include "../src/HTTPRequest.hpp"
21+
#include "../src/HTTPResponse.hpp"
2222

2323
namespace httpsserver {
2424

@@ -147,4 +147,4 @@ class HTTPConnection : private ConnectionContext {
147147

148148
} /* namespace httpsserver */
149149

150-
#endif /* HTTPS_HTTPCONNECTION_HPP_ */
150+
#endif /* SRC_HTTPCONNECTION_HPP_ */

https/HTTPHeader.cpp renamed to src/HTTPHeader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: frank
66
*/
77

8-
#include "HTTPHeader.hpp"
8+
#include "../src/HTTPHeader.hpp"
99

1010
namespace httpsserver {
1111

https/HTTPHeader.hpp renamed to src/HTTPHeader.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Author: frank
66
*/
77

8-
#ifndef HTTPS_HTTPHEADER_HPP_
9-
#define HTTPS_HTTPHEADER_HPP_
8+
#ifndef SRC_HTTPHEADER_HPP_
9+
#define SRC_HTTPHEADER_HPP_
1010

1111
#include <string>
1212

@@ -23,4 +23,4 @@ class HTTPHeader {
2323

2424
} /* namespace httpsserver */
2525

26-
#endif /* HTTPS_HTTPHEADER_HPP_ */
26+
#endif /* SRC_HTTPHEADER_HPP_ */

https/HTTPHeaders.cpp renamed to src/HTTPHeaders.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: frank
66
*/
77

8-
#include "HTTPHeaders.hpp"
8+
#include "../src/HTTPHeaders.hpp"
99

1010
namespace httpsserver {
1111

https/HTTPHeaders.hpp renamed to src/HTTPHeaders.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
* Author: frank
66
*/
77

8-
#ifndef HTTPS_HTTPHEADERS_HPP_
9-
#define HTTPS_HTTPHEADERS_HPP_
8+
#ifndef SRC_HTTPHEADERS_HPP_
9+
#define SRC_HTTPHEADERS_HPP_
1010

1111
#include <string>
1212
// Arduino declares it's own min max, incompatible with the stl...
1313
#undef min
1414
#undef max
1515
#include <vector>
1616

17-
#include "HTTPSServerConstants.hpp"
18-
#include "HTTPHeader.hpp"
17+
#include "../src/HTTPSServerConstants.hpp"
18+
#include "../src/HTTPHeader.hpp"
1919

2020
namespace httpsserver {
2121

@@ -37,4 +37,4 @@ class HTTPHeaders {
3737

3838
} /* namespace httpsserver */
3939

40-
#endif /* HTTPS_HTTPHEADERS_HPP_ */
40+
#endif /* SRC_HTTPHEADERS_HPP_ */

https/HTTPMiddlewareFunction.hpp renamed to src/HTTPMiddlewareFunction.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#ifndef HTTPS_HTTPMIDDLEWAREFUNCTION_HPP_
2-
#define HTTPS_HTTPMIDDLEWAREFUNCTION_HPP_
1+
#ifndef SRC_HTTPMIDDLEWAREFUNCTION_HPP_
2+
#define SRC_HTTPMIDDLEWAREFUNCTION_HPP_
33

44
#include <functional>
55

6-
#include "HTTPRequest.hpp"
7-
#include "HTTPResponse.hpp"
8-
#include "HTTPSCallbackFunction.hpp"
6+
#include "../src/HTTPRequest.hpp"
7+
#include "../src/HTTPResponse.hpp"
8+
#include "../src/HTTPSCallbackFunction.hpp"
99

1010
namespace httpsserver {
1111
/**
@@ -22,4 +22,4 @@ namespace httpsserver {
2222
*/
2323
typedef void (HTTPSMiddlewareFunction)(HTTPRequest * req, HTTPResponse * res, std::function<void()> next);
2424
}
25-
#endif /* HTTPS_HTTPMIDDLEWAREFUNCTION_HPP_ */
25+
#endif /* SRC_HTTPMIDDLEWAREFUNCTION_HPP_ */

https/HTTPRequest.cpp renamed to src/HTTPRequest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: frank
66
*/
77

8-
#include "HTTPRequest.hpp"
8+
#include "../src/HTTPRequest.hpp"
99

1010
namespace httpsserver {
1111

https/HTTPRequest.hpp renamed to src/HTTPRequest.hpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@
55
* Author: frank
66
*/
77

8-
#ifndef HTTPS_HTTPREQUEST_HPP_
9-
#define HTTPS_HTTPREQUEST_HPP_
8+
#ifndef SRC_HTTPREQUEST_HPP_
9+
#define SRC_HTTPREQUEST_HPP_
1010

1111
#include <Arduino.h>
1212
#include <string>
1313

1414
#include <mbedtls/base64.h>
1515

16-
#include "util.hpp"
17-
18-
#include "ConnectionContext.hpp"
19-
#include "ResourceParameters.hpp"
20-
#include "HTTPHeaders.hpp"
21-
#include "HTTPHeader.hpp"
16+
#include "../src/ConnectionContext.hpp"
17+
#include "../src/HTTPHeader.hpp"
18+
#include "../src/HTTPHeaders.hpp"
19+
#include "../src/ResourceParameters.hpp"
20+
#include "../src/util.hpp"
2221

2322
namespace httpsserver {
2423

@@ -59,4 +58,4 @@ class HTTPRequest {
5958

6059
} /* namespace httpsserver */
6160

62-
#endif /* HTTPS_HTTPREQUEST_HPP_ */
61+
#endif /* SRC_HTTPREQUEST_HPP_ */

https/HTTPResponse.cpp renamed to src/HTTPResponse.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
*/
77

88
// needed for HTTP sockets
9+
#include "../src/HTTPResponse.hpp"
10+
911
#include <Arduino.h>
1012
#include "lwip/sockets.h"
1113

12-
#include "HTTPResponse.hpp"
1314

1415
namespace httpsserver {
1516

https/HTTPResponse.hpp renamed to src/HTTPResponse.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Author: frank
66
*/
77

8-
#ifndef HTTPS_HTTPRESPONSE_HPP_
9-
#define HTTPS_HTTPRESPONSE_HPP_
8+
#ifndef SRC_HTTPRESPONSE_HPP_
9+
#define SRC_HTTPRESPONSE_HPP_
1010

1111
#include <Arduino.h>
1212
#include <string>
@@ -18,11 +18,11 @@
1818

1919
#include <openssl/ssl.h>
2020

21-
#include "util.hpp"
21+
#include "../src/util.hpp"
2222

23-
#include "ConnectionContext.hpp"
24-
#include "HTTPHeaders.hpp"
25-
#include "HTTPHeader.hpp"
23+
#include "../src/ConnectionContext.hpp"
24+
#include "../src/HTTPHeaders.hpp"
25+
#include "../src/HTTPHeader.hpp"
2626

2727
namespace httpsserver {
2828

@@ -71,4 +71,4 @@ class HTTPResponse : public Print {
7171

7272
} /* namespace httpsserver */
7373

74-
#endif /* HTTPS_HTTPRESPONSE_HPP_ */
74+
#endif /* SRC_HTTPRESPONSE_HPP_ */

https/HTTPSCallbackFunction.hpp renamed to src/HTTPSCallbackFunction.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
* Author: frank
66
*/
77

8-
#ifndef HTTPS_HTTPSCALLBACKFUNCTION_HPP_
9-
#define HTTPS_HTTPSCALLBACKFUNCTION_HPP_
8+
#ifndef SRC_HTTPSCALLBACKFUNCTION_HPP_
9+
#define SRC_HTTPSCALLBACKFUNCTION_HPP_
1010

11-
#include "HTTPRequest.hpp"
12-
#include "HTTPResponse.hpp"
11+
#include "../src/HTTPRequest.hpp"
12+
#include "../src/HTTPResponse.hpp"
1313

1414
namespace httpsserver {
1515
typedef void (HTTPSCallbackFunction)(HTTPRequest * req, HTTPResponse * res);
1616
}
1717

18-
#endif /* HTTPS_HTTPSCALLBACKFUNCTION_HPP_ */
18+
#endif /* SRC_HTTPSCALLBACKFUNCTION_HPP_ */

https/HTTPSConnection.cpp renamed to src/HTTPSConnection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: frank
66
*/
77

8-
#include "HTTPSConnection.hpp"
8+
#include "../src/HTTPSConnection.hpp"
99

1010
namespace httpsserver {
1111

https/HTTPSConnection.hpp renamed to src/HTTPSConnection.hpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Author: frank
66
*/
77

8-
#ifndef HTTPS_HTTPSCONNECTION_HPP_
9-
#define HTTPS_HTTPSCONNECTION_HPP_
8+
#ifndef SRC_HTTPSCONNECTION_HPP_
9+
#define SRC_HTTPSCONNECTION_HPP_
1010

1111
#include <Arduino.h>
1212

@@ -21,15 +21,15 @@
2121
#undef read
2222
#include "lwip/sockets.h"
2323

24-
#include "HTTPSServerConstants.hpp"
25-
#include "HTTPConnection.hpp"
26-
#include "HTTPHeaders.hpp"
27-
#include "HTTPHeader.hpp"
28-
#include "ResourceResolver.hpp"
29-
#include "ResolvedResource.hpp"
30-
#include "ResourceNode.hpp"
31-
#include "HTTPRequest.hpp"
32-
#include "HTTPResponse.hpp"
24+
#include "../src/HTTPSServerConstants.hpp"
25+
#include "../src/HTTPConnection.hpp"
26+
#include "../src/HTTPHeaders.hpp"
27+
#include "../src/HTTPHeader.hpp"
28+
#include "../src/ResourceResolver.hpp"
29+
#include "../src/ResolvedResource.hpp"
30+
#include "../src/ResourceNode.hpp"
31+
#include "../src/HTTPRequest.hpp"
32+
#include "../src/HTTPResponse.hpp"
3333

3434
namespace httpsserver {
3535

@@ -59,4 +59,4 @@ class HTTPSConnection : public HTTPConnection {
5959

6060
} /* namespace httpsserver */
6161

62-
#endif /* HTTPS_HTTPSCONNECTION_HPP_ */
62+
#endif /* SRC_HTTPSCONNECTION_HPP_ */

https/HTTPSServer.cpp renamed to src/HTTPSServer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Author: frank
66
*/
77

8-
#include "HTTPSServer.hpp"
8+
#include "../src/HTTPSServer.hpp"
99

1010
namespace httpsserver {
1111

0 commit comments

Comments
 (0)