├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ └── Issue-report.yml └── FUNDING.yml ├── .gitignore ├── docs └── html │ ├── bc_s.png │ ├── bdwn.png │ ├── doc.png │ ├── docd.png │ ├── open.png │ ├── bc_sd.png │ ├── closed.png │ ├── nav_f.png │ ├── nav_fd.png │ ├── nav_g.png │ ├── nav_h.png │ ├── nav_hd.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_ad.png │ ├── tab_b.png │ ├── tab_bd.png │ ├── tab_h.png │ ├── tab_hd.png │ ├── tab_s.png │ ├── tab_sd.png │ ├── splitbar.png │ ├── splitbard.png │ ├── sync_off.png │ ├── folderclosed.png │ ├── folderopen.png │ ├── search │ ├── search_l.png │ ├── search_m.png │ ├── search_r.png │ ├── pages_1.js │ ├── files_0.js │ ├── namespaces_0.js │ ├── pages_0.js │ ├── classes_0.js │ ├── classes_6.js │ ├── pages_2.js │ ├── classes_7.js │ ├── enums_0.js │ ├── functions_11.js │ ├── all_5.js │ ├── functions_5.js │ ├── all_11.js │ ├── classes_a.js │ ├── classes_9.js │ ├── classes_5.js │ ├── classes_3.js │ ├── functions_3.js │ ├── classes_c.js │ ├── functions_b.js │ ├── all_14.js │ ├── functions_12.js │ ├── functions_1.js │ ├── all_3.js │ ├── all_12.js │ ├── classes_b.js │ ├── all_b.js │ ├── all_1.js │ ├── functions_a.js │ ├── searchdata.js │ ├── all_13.js │ ├── classes_8.js │ ├── nomatches.html │ ├── functions_7.js │ ├── all_a.js │ ├── all_d.js │ ├── functions_d.js │ ├── mag.svg │ ├── mag_d.svg │ ├── classes_1.js │ ├── close.svg │ ├── classes_4.js │ ├── functions_10.js │ ├── all_6.js │ ├── functions_6.js │ ├── mag_sel.svg │ ├── mag_seld.svg │ ├── functions_0.js │ ├── functions_2.js │ ├── all_2.js │ ├── functions_9.js │ ├── all_0.js │ ├── all_10.js │ ├── functions_8.js │ ├── functions_4.js │ ├── all_0.html │ ├── all_1.html │ ├── all_2.html │ ├── all_3.html │ ├── all_4.html │ ├── all_5.html │ ├── all_6.html │ ├── all_7.html │ ├── all_8.html │ ├── all_9.html │ ├── all_a.html │ ├── all_b.html │ ├── all_c.html │ ├── all_d.html │ ├── all_e.html │ ├── all_f.html │ ├── all_10.html │ ├── all_11.html │ ├── all_12.html │ ├── all_13.html │ ├── all_14.html │ ├── enums_0.html │ ├── files_0.html │ ├── pages_0.html │ ├── classes_0.html │ ├── classes_1.html │ ├── classes_2.html │ ├── classes_3.html │ ├── classes_4.html │ ├── classes_5.html │ ├── classes_6.html │ ├── classes_7.html │ ├── classes_8.html │ ├── classes_9.html │ ├── classes_a.html │ ├── classes_b.html │ ├── classes_c.html │ ├── functions_0.html │ ├── functions_1.html │ ├── functions_10.html │ ├── functions_11.html │ ├── functions_12.html │ ├── functions_2.html │ ├── functions_3.html │ ├── functions_4.html │ ├── functions_5.html │ ├── functions_6.html │ ├── functions_7.html │ ├── functions_8.html │ ├── functions_9.html │ ├── functions_a.html │ ├── functions_b.html │ ├── functions_c.html │ ├── functions_d.html │ ├── functions_e.html │ ├── functions_f.html │ ├── namespaces_0.html │ ├── all_8.js │ ├── classes_2.js │ ├── functions_f.js │ ├── all_9.js │ ├── all_7.js │ └── all_4.js │ ├── classtinyhttp_1_1_str.png │ ├── classtinyhttp_1_1_client.png │ ├── classtinyhttp_1_1_stream.png │ ├── classtinyhttp_1_1_extension.png │ ├── classtinyhttp_1_1_str_ext.png │ ├── classtinyhttp_1_1_str_view.png │ ├── classtinyhttp_1_1_http_header.png │ ├── classtinyhttp_1_1_serial_def.png │ ├── classtinyhttp_1_1_extension_s_d.png │ ├── classtinyhttp_1_1_wi_fi_client.png │ ├── classtinyhttp_1_1_extension_stream.png │ ├── classtinyhttp_1_1_http_line_reader.png │ ├── classtinyhttp_1_1_extension_web_copy.png │ ├── classtinyhttp_1_1_http_chunk_reader.png │ ├── classtinyhttp_1_1_http_reply_header.png │ ├── classtinyhttp_1_1_http_request_header.png │ ├── classtinyhttp_1_1_extension_e_s_p_task.png │ ├── classtinyhttp_1_1_http_streamed_output.png │ ├── classtinyhttp_1_1_extension_logging_stream.png │ ├── classtinyhttp_1_1_extension_s_d_streamed.png │ ├── classtinyhttp_1_1_extension_stream_basic.png │ ├── classtinyhttp_1_1_extension_stream_shared.png │ ├── classtinyhttp_1_1_http_streamed_multi_output.png │ ├── classtinyhttp_1_1_extension_music_file_stream.png │ ├── minus.svg │ ├── minusd.svg │ ├── plus.svg │ ├── plusd.svg │ ├── doc.svg │ ├── docd.svg │ ├── folderclosed.svg │ └── folderclosedd.svg ├── keywords.txt ├── src ├── HttpServer.h ├── HttpExtensions.h ├── Platform │ ├── AltArduino.h │ └── AltStream.h ├── Server │ ├── HttpRequestRewrite.h │ ├── HttpCommon.h │ ├── HttpCommon.cpp │ ├── HttpChunkWriter.h │ ├── HttpTunnel.h │ ├── HttpStreamedOutput.h │ ├── HttpRequestHandlerLine.h │ ├── HttpStreamCopy.h │ ├── HttpLogger.h │ └── HttpLineReader.h ├── Extensions │ ├── Extension.h │ ├── ExtensionLoggingStream.h │ └── ExtensionSD.h ├── CMakeLists.txt └── Utils │ └── MimeResolver.h ├── library.properties ├── examples ├── zany_experiments │ ├── webCopy │ │ └── webCopy.ino │ ├── serverWebCopy │ │ └── serverWebCopy.ino │ └── client │ │ └── client.ino ├── ticker │ └── ticker.ino ├── serverLog │ └── serverLog.ino ├── serverWithTask │ └── serverWithTask.ino ├── serverPostMP3 │ └── serverPostMP3.ino ├── serverStream │ └── serverStream.ino ├── webservice │ ├── webservice │ │ └── webservice.ino │ └── webservice-ext │ │ └── webservice-ext.ino ├── serverMP3 │ └── serverMP3.ino ├── server │ └── server.ino └── serverSD │ └── serverSD.ino └── CMakeLists.txt /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | examples/.DS_Store 3 | src/.DS_Store 4 | .DS_Store 5 | build/ 6 | -------------------------------------------------------------------------------- /docs/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/bc_s.png -------------------------------------------------------------------------------- /docs/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/bdwn.png -------------------------------------------------------------------------------- /docs/html/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/doc.png -------------------------------------------------------------------------------- /docs/html/docd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/docd.png -------------------------------------------------------------------------------- /docs/html/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/open.png -------------------------------------------------------------------------------- /docs/html/bc_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/bc_sd.png -------------------------------------------------------------------------------- /docs/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/closed.png -------------------------------------------------------------------------------- /docs/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/nav_f.png -------------------------------------------------------------------------------- /docs/html/nav_fd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/nav_fd.png -------------------------------------------------------------------------------- /docs/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/nav_g.png -------------------------------------------------------------------------------- /docs/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/nav_h.png -------------------------------------------------------------------------------- /docs/html/nav_hd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/nav_hd.png -------------------------------------------------------------------------------- /docs/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/sync_on.png -------------------------------------------------------------------------------- /docs/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_a.png -------------------------------------------------------------------------------- /docs/html/tab_ad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_ad.png -------------------------------------------------------------------------------- /docs/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_b.png -------------------------------------------------------------------------------- /docs/html/tab_bd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_bd.png -------------------------------------------------------------------------------- /docs/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_h.png -------------------------------------------------------------------------------- /docs/html/tab_hd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_hd.png -------------------------------------------------------------------------------- /docs/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_s.png -------------------------------------------------------------------------------- /docs/html/tab_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/tab_sd.png -------------------------------------------------------------------------------- /docs/html/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/splitbar.png -------------------------------------------------------------------------------- /docs/html/splitbard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/splitbard.png -------------------------------------------------------------------------------- /docs/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/sync_off.png -------------------------------------------------------------------------------- /docs/html/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/folderclosed.png -------------------------------------------------------------------------------- /docs/html/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/folderopen.png -------------------------------------------------------------------------------- /docs/html/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/search/search_l.png -------------------------------------------------------------------------------- /docs/html/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/search/search_m.png -------------------------------------------------------------------------------- /docs/html/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/search/search_r.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_str.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_str.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_client.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_stream.png -------------------------------------------------------------------------------- /docs/html/search/pages_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['server_0',['TinyHttp (Media) Server',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_str_ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_str_ext.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_str_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_str_view.png -------------------------------------------------------------------------------- /docs/html/search/files_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['altarduino_2eh_0',['AltArduino.h',['../_alt_arduino_8h.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/namespaces_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['tinyhttp_167',['tinyhttp',['../namespacetinyhttp.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['media_20server_0',['TinyHttp (Media) Server',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_http_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_http_header.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_serial_def.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_serial_def.png -------------------------------------------------------------------------------- /docs/html/search/classes_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['client_0',['Client',['../classtinyhttp_1_1_client.html',1,'tinyhttp']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_s_d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_s_d.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_wi_fi_client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_wi_fi_client.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_stream.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_http_line_reader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_http_line_reader.png -------------------------------------------------------------------------------- /docs/html/search/classes_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['node_0',['Node',['../structtinyhttp_1_1_list_1_1_node.html',1,'tinyhttp::List']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/pages_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['tinyhttp_20media_20server_0',['TinyHttp (Media) Server',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_web_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_web_copy.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_http_chunk_reader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_http_chunk_reader.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_http_reply_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_http_reply_header.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_http_request_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_http_request_header.png -------------------------------------------------------------------------------- /docs/html/search/classes_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ringbuffer_0',['RingBuffer',['../classtinyhttp_1_1_ring_buffer.html',1,'tinyhttp']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_e_s_p_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_e_s_p_task.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_http_streamed_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_http_streamed_output.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_logging_stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_logging_stream.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_s_d_streamed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_s_d_streamed.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_stream_basic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_stream_basic.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_stream_shared.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_stream_shared.png -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_http_streamed_multi_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_http_streamed_multi_output.png -------------------------------------------------------------------------------- /docs/html/search/enums_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['loglevel_238',['LogLevel',['../namespacetinyhttp.html#a64d2834c52ef1835cf77d1684cfba4d8',1,'tinyhttp']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/classtinyhttp_1_1_extension_music_file_stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pschatzmann/TinyHttp/HEAD/docs/html/classtinyhttp_1_1_extension_music_file_stream.png -------------------------------------------------------------------------------- /docs/html/search/functions_11.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['webcopy_0',['WebCopy',['../classtinyhttp_1_1_web_copy.html#afaf7f107ba257ec9204d6e1c904c0abb',1,'tinyhttp::WebCopy']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/all_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['floattostring_0',['floatToString',['../classtinyhttp_1_1_str_view.html#a34d27d4a4763e4f844b5e276187e24df',1,'tinyhttp::StrView']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/functions_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['floattostring_0',['floatToString',['../classtinyhttp_1_1_str_view.html#a34d27d4a4763e4f844b5e276187e24df',1,'tinyhttp::StrView']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/all_11.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['url_0',['Url',['../classtinyhttp_1_1_url.html',1,'tinyhttp']]], 4 | ['urlextractor_1',['UrlExtractor',['../classtinyhttp_1_1_url_extractor.html',1,'tinyhttp']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/classes_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['url_0',['Url',['../classtinyhttp_1_1_url.html',1,'tinyhttp']]], 4 | ['urlextractor_1',['UrlExtractor',['../classtinyhttp_1_1_url_extractor.html',1,'tinyhttp']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/classes_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ticker_0',['Ticker',['../classtinyhttp_1_1_ticker.html',1,'tinyhttp']]], 4 | ['tickerentry_1',['TickerEntry',['../structtinyhttp_1_1_ticker_entry.html',1,'tinyhttp']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/classes_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['mimeextension_0',['MimeExtension',['../structtinyhttp_1_1_mime_extension.html',1,'tinyhttp']]], 4 | ['mimeresolver_1',['MimeResolver',['../classtinyhttp_1_1_mime_resolver.html',1,'tinyhttp']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | FTP KEYWORD1 2 | Client KEYWORD1 3 | FTP Client KEYWORD1 4 | Files KEYWORD1 5 | Remote Files KEYWORD1 6 | API KEYWORD1 7 | FTPFile KEYWORD1 8 | Client KEYWORD1 9 | FTPClient KEYWORD1 10 | FileNameIterator KEYWORD1 11 | FTPBasicAPI KEYWORD1 12 | -------------------------------------------------------------------------------- /docs/html/search/classes_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['iterator_0',['iterator',['../classtinyhttp_1_1_list_1_1_iterator.html',1,'tinyhttp::List< T >::Iterator'],['../classtinyhttp_1_1_vector_1_1iterator.html',1,'tinyhttp::Vector< T >::iterator']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /src/HttpServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define TINY_HTTP_SERVER 1 3 | #include "Server/HttpServer.h" 4 | #include "Server/HttpRequest.h" 5 | #include "Server/HttpParameters.h" 6 | #include "Utils/Ticker.h" 7 | #include "Utils/UrlExtractor.h" 8 | 9 | using namespace tinyhttp; 10 | -------------------------------------------------------------------------------- /docs/html/search/functions_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['doloop_0',['doloop',['../classtinyhttp_1_1_http_server.html#a2fadb077815d86abc0f704506d969439',1,'tinyhttp::HttpServer::doLoop()'],['../classtinyhttp_1_1_ticker.html#ab9d04870a4b7bbde66213937994ff036',1,'tinyhttp::Ticker::doLoop()']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/classes_c.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['webcopy_0',['WebCopy',['../classtinyhttp_1_1_web_copy.html',1,'tinyhttp']]], 4 | ['wificlient_1',['WiFiClient',['../classtinyhttp_1_1_wi_fi_client.html',1,'tinyhttp']]], 5 | ['wifimock_2',['WifiMock',['../classtinyhttp_1_1_wifi_mock.html',1,'tinyhttp']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/functions_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['nullstr_0',['nullstr',['../classtinyhttp_1_1_http_server.html#ad147ccd06262d7f07a3ae9f72ce7107a',1,'tinyhttp::HttpServer']]], 4 | ['numberofdecimals_1',['numberOfDecimals',['../classtinyhttp_1_1_str_view.html#ac85aa3b5d6ae9bd5bb4c2e6a9680d596',1,'tinyhttp::StrView']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_14.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['_7ehttpparameters_0',['~HttpParameters',['../classtinyhttp_1_1_http_parameters.html#a5172f1c87ea4ca7cf9b7df9f492838ee',1,'tinyhttp::HttpParameters']]], 4 | ['_7ewebcopy_1',['~WebCopy',['../classtinyhttp_1_1_web_copy.html#aca6c0729b0fc688c71a93724bcf89330',1,'tinyhttp::WebCopy']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_12.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['_7ehttpparameters_0',['~HttpParameters',['../classtinyhttp_1_1_http_parameters.html#a5172f1c87ea4ca7cf9b7df9f492838ee',1,'tinyhttp::HttpParameters']]], 4 | ['_7ewebcopy_1',['~WebCopy',['../classtinyhttp_1_1_web_copy.html#aca6c0729b0fc688c71a93724bcf89330',1,'tinyhttp::WebCopy']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/functions_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['begin_0',['begin',['../classtinyhttp_1_1_http_server.html#a3e28b3aa2e0a9a98c5c483d214c9ed94',1,'tinyhttp::HttpServer::begin(int port, const char *ssid, const char *password)'],['../classtinyhttp_1_1_http_server.html#a1edf6e606d14767d822ff122bb65c6b2',1,'tinyhttp::HttpServer::begin(int port)']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=TinyHttp 2 | version=1.0 3 | author=SSID 4 | maintainer= 5 | sentence=A Http client and server (not only) for Arduino 6 | paragraph=A Http client, Http server, SD card, Dump Websites, Streaming Server 7 | category=Communication 8 | url=https://github.com/pschatzmann/TinyHttp.git 9 | architectures=* 10 | 11 | -------------------------------------------------------------------------------- /docs/html/search/all_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['documentation_0',['Documentation',['../index.html#autotoc_md5',1,'']]], 4 | ['doloop_1',['doloop',['../classtinyhttp_1_1_http_server.html#a2fadb077815d86abc0f704506d969439',1,'tinyhttp::HttpServer::doLoop()'],['../classtinyhttp_1_1_ticker.html#ab9d04870a4b7bbde66213937994ff036',1,'tinyhttp::Ticker::doLoop()']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/html/search/all_12.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['vector_0',['Vector',['../classtinyhttp_1_1_vector.html',1,'tinyhttp']]], 4 | ['vector_3c_20char_20_3e_1',['Vector< char >',['../classtinyhttp_1_1_vector.html',1,'tinyhttp']]], 5 | ['vector_3c_20httpparameterentry_20_2a_20_3e_2',['Vector< HttpParameterEntry * >',['../classtinyhttp_1_1_vector.html',1,'tinyhttp']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/classes_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['vector_0',['Vector',['../classtinyhttp_1_1_vector.html',1,'tinyhttp']]], 4 | ['vector_3c_20char_20_3e_1',['Vector< char >',['../classtinyhttp_1_1_vector.html',1,'tinyhttp']]], 5 | ['vector_3c_20httpparameterentry_20_2a_20_3e_2',['Vector< HttpParameterEntry * >',['../classtinyhttp_1_1_vector.html',1,'tinyhttp']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /src/HttpExtensions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Extensions/ExtensionStream.h" 3 | #include "Extensions/ExtensionLoggingStream.h" 4 | 5 | #ifndef TINYHTTP_NO_SD 6 | #include "Extensions/ExtensionSD.h" 7 | #include "Extensions/ExtensionSDStreamed.h" 8 | #include "Extensions/ExtensionMusicFileStream.h" 9 | #endif 10 | 11 | #ifdef ESP32 12 | #include "Extensions/ExtensionESPTask.h" 13 | #endif -------------------------------------------------------------------------------- /docs/html/search/all_b.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['node_0',['Node',['../structtinyhttp_1_1_list_1_1_node.html',1,'tinyhttp::List']]], 4 | ['nullstr_1',['nullstr',['../classtinyhttp_1_1_http_server.html#ad147ccd06262d7f07a3ae9f72ce7107a',1,'tinyhttp::HttpServer']]], 5 | ['numberofdecimals_2',['numberOfDecimals',['../classtinyhttp_1_1_str_view.html#ac85aa3b5d6ae9bd5bb4c2e6a9680d596',1,'tinyhttp::StrView']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/all_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['basic_20server_0',['Example: Basic Server',['../index.html#autotoc_md1',1,'']]], 4 | ['begin_1',['begin',['../classtinyhttp_1_1_http_server.html#a3e28b3aa2e0a9a98c5c483d214c9ed94',1,'tinyhttp::HttpServer::begin(int port, const char *ssid, const char *password)'],['../classtinyhttp_1_1_http_server.html#a1edf6e606d14767d822ff122bb65c6b2',1,'tinyhttp::HttpServer::begin(int port)']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /src/Platform/AltArduino.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file AltArduino.h 3 | * @author Phil Schatzmann 4 | * @brief Some basic Classes which are usually provided by Arduino 5 | * @version 0.1 6 | * @date 2020-12-02 7 | * 8 | * @copyright Copyright (c) 2020 9 | * 10 | */ 11 | #pragma once 12 | 13 | #ifdef PLATFORM_LINUX 14 | 15 | #include 16 | #include "Platform/AltClient.h" 17 | #include "Platform/AltStream.h" 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /docs/html/search/functions_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['matches_0',['matches',['../classtinyhttp_1_1_str_view.html#a5fae7157aeffdb171d668b78d1af48e6',1,'tinyhttp::StrView']]], 4 | ['matchesmime_1',['matchesMime',['../classtinyhttp_1_1_http_server.html#abeb95826a84ea16c48556336a06dc26b',1,'tinyhttp::HttpServer']]], 5 | ['maxlength_2',['maxLength',['../classtinyhttp_1_1_str_view.html#a01842c2d48547559527c9771be6074dc',1,'tinyhttp::StrView']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "abcdefghilmnoprstuvw~", 4 | 1: "cehilmnrstuvw", 5 | 2: "a", 6 | 3: "abcdefghilmnoprstw~", 7 | 4: "mst" 8 | }; 9 | 10 | var indexSectionNames = 11 | { 12 | 0: "all", 13 | 1: "classes", 14 | 2: "files", 15 | 3: "functions", 16 | 4: "pages" 17 | }; 18 | 19 | var indexSectionLabels = 20 | { 21 | 0: "All", 22 | 1: "Classes", 23 | 2: "Files", 24 | 3: "Functions", 25 | 4: "Pages" 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /src/Server/HttpRequestRewrite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Basic/Str.h" 4 | 5 | namespace tinyhttp { 6 | 7 | /** 8 | * @brief Object which information about the rewrite rule 9 | * 10 | */ 11 | class HttpRequestRewrite { 12 | public: 13 | HttpRequestRewrite(const char *from, const char* to ){ 14 | this->from = StrView(from); 15 | this->to = StrView(to); 16 | } 17 | StrView from; 18 | StrView to; 19 | 20 | }; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /docs/html/search/all_13.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['webcopy_0',['webcopy',['../classtinyhttp_1_1_web_copy.html',1,'tinyhttp::WebCopy'],['../classtinyhttp_1_1_web_copy.html#afaf7f107ba257ec9204d6e1c904c0abb',1,'tinyhttp::WebCopy::WebCopy()']]], 4 | ['wificlient_1',['WiFiClient',['../classtinyhttp_1_1_wi_fi_client.html',1,'tinyhttp']]], 5 | ['wifimock_2',['WifiMock',['../classtinyhttp_1_1_wifi_mock.html',1,'tinyhttp']]], 6 | ['with_20http_3',['Example - Logging with Http',['../index.html#autotoc_md4',1,'']]] 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Server/HttpCommon.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // the functions have been defined in the header so we just need to take care of the 4 | // allocation of the static and shared data 5 | 6 | namespace tinyhttp { 7 | 8 | /** 9 | * @brief Mapping from file extensions to mime types 10 | * 11 | */ 12 | struct MimeExtension { 13 | const char* extension; 14 | const char* mime; 15 | }; 16 | 17 | extern const MimeExtension defaultMimeTable[11]; 18 | extern const MimeExtension* mimeTable; 19 | 20 | 21 | } // namespace 22 | -------------------------------------------------------------------------------- /docs/html/search/classes_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sdfilenamemgr_0',['SDFileNameMgr',['../classtinyhttp_1_1_s_d_file_name_mgr.html',1,'tinyhttp']]], 4 | ['sdstack_1',['SDStack',['../classtinyhttp_1_1_s_d_stack.html',1,'tinyhttp']]], 5 | ['serialdef_2',['SerialDef',['../classtinyhttp_1_1_serial_def.html',1,'tinyhttp']]], 6 | ['str_3',['Str',['../classtinyhttp_1_1_str.html',1,'tinyhttp']]], 7 | ['stream_4',['Stream',['../classtinyhttp_1_1_stream.html',1,'tinyhttp']]], 8 | ['strview_5',['StrView',['../classtinyhttp_1_1_str_view.html',1,'tinyhttp']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /docs/html/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |
No Matches
11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/html/minus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Extensions/Extension.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace tinyhttp { 4 | 5 | // forward declaration 6 | class HttpServer; 7 | 8 | /** 9 | * @brief The HttpServer supports the registraiton of Extensions to 10 | * implement some additional functionalry which is not supported in 11 | * the basic impelementation. E.g SD support. 12 | * 13 | */ 14 | class Extension { 15 | friend class HttpServer; 16 | 17 | public: 18 | Extension(){} 19 | virtual void open(HttpServer *server) {}; 20 | 21 | protected: 22 | virtual void doLoop() {}; 23 | 24 | }; 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /docs/html/minusd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/zany_experiments/webCopy/webCopy.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Utils/WebCopy.h" 3 | #include "WiFiClientSecure.h" 4 | 5 | using namespace tinyhttp; 6 | 7 | WiFiClientSecure client; 8 | 9 | void setup() { 10 | Serial.begin(115200); 11 | // connect to WIFI 12 | WiFi.begin("SSID", "password"); 13 | while (WiFi.status() != WL_CONNECTED) { 14 | delay(500); 15 | Serial.print("."); 16 | } 17 | 18 | // setup logger 19 | HttpLogger.begin(Serial, Info); 20 | 21 | // start the dump 22 | WebCopy webCopy(client, false); 23 | webCopy.start("https://www.pschatzmann.ch/home"); 24 | } 25 | 26 | void loop() { 27 | } -------------------------------------------------------------------------------- /docs/html/search/functions_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['haskey_0',['hasKey',['../classtinyhttp_1_1_http_parameters.html#a8fe27108ffbd6d50a9d4cdfc57e4077e',1,'tinyhttp::HttpParameters']]], 4 | ['httpchunkreader_1',['httpchunkreader',['../classtinyhttp_1_1_http_chunk_reader.html#a9568f9de19f81a47a933819af365c33d',1,'tinyhttp::HttpChunkReader::HttpChunkReader()'],['../classtinyhttp_1_1_http_chunk_reader.html#acbfc3feca63efea9f2dd4e5832be816d',1,'tinyhttp::HttpChunkReader::HttpChunkReader(HttpReplyHeader &header)']]], 5 | ['httpparameters_2',['HttpParameters',['../classtinyhttp_1_1_http_parameters.html#aad3e97e6799540df8c5c22254d830116',1,'tinyhttp::HttpParameters']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/all_a.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['matches_0',['matches',['../classtinyhttp_1_1_str_view.html#a5fae7157aeffdb171d668b78d1af48e6',1,'tinyhttp::StrView']]], 4 | ['matchesmime_1',['matchesMime',['../classtinyhttp_1_1_http_server.html#abeb95826a84ea16c48556336a06dc26b',1,'tinyhttp::HttpServer']]], 5 | ['maxlength_2',['maxLength',['../classtinyhttp_1_1_str_view.html#a01842c2d48547559527c9771be6074dc',1,'tinyhttp::StrView']]], 6 | ['media_20server_3',['TinyHttp (Media) Server',['../index.html',1,'']]], 7 | ['mimeextension_4',['MimeExtension',['../structtinyhttp_1_1_mime_extension.html',1,'tinyhttp']]], 8 | ['mimeresolver_5',['MimeResolver',['../classtinyhttp_1_1_mime_resolver.html',1,'tinyhttp']]] 9 | ]; 10 | -------------------------------------------------------------------------------- /src/Extensions/ExtensionLoggingStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ExtensionStream.h" 4 | 5 | #define HTML_HEADER "

Web Logger

" 6 | #define HTML_END "" 7 | 8 | namespace tinyhttp { 9 | 10 | /** 11 | * @brief A Simple Logger 12 | * 13 | */ 14 | class ExtensionLoggingStream : public ExtensionStream { 15 | 16 | public: 17 | ExtensionLoggingStream(const char* url, TinyMethodID action=T_GET, const char* mime="text/html", const char* startHtml=HTML_HEADER, const char* endHtml=HTML_END, int bufferSize=256, int historySize=1024) 18 | : ExtensionStream (url, action, mime, startHtml, endHtml, bufferSize, historySize){ 19 | } 20 | }; 21 | 22 | } -------------------------------------------------------------------------------- /src/Server/HttpCommon.cpp: -------------------------------------------------------------------------------- 1 | 2 | // the functions have been defined in the header so we just need to take care of the 3 | // allocation of the static and shared data 4 | 5 | #include "Server/HttpCommon.h" 6 | 7 | namespace tinyhttp { 8 | 9 | constexpr const MimeExtension defaultMimeTable[] = { 10 | {".htm","text/html"}, 11 | {".css","text/css"}, 12 | {".xml","text/xml"}, 13 | {".js","application/javascript"}, 14 | {".png","image/png"}, 15 | {".gif","image/gif"}, 16 | {".jpeg","image/jpeg"}, 17 | {".ico","image/x-icon"}, 18 | {".pdf","application/pdf"}, 19 | {".zip","application/zip"}, 20 | {nullptr,nullptr} 21 | }; 22 | 23 | 24 | const MimeExtension* mimeTable; 25 | 26 | } // namespace 27 | -------------------------------------------------------------------------------- /docs/html/plus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/html/plusd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/ticker/ticker.ino: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @file ticker.ino 4 | * @author Phil Schatzmann 5 | * @brief The ticker executes a scheduled function in a defined interval 6 | * @version 0.1 7 | * @date 2022-09-03 8 | * 9 | * @copyright Copyright (c) 2022 10 | * 11 | */ 12 | 13 | #include "HttpServer.h" 14 | 15 | Ticker ticker; 16 | 17 | void hallo(void*) { 18 | Serial.println("hallo..."); 19 | HttpLogger.begin(Serial,Info); 20 | } 21 | 22 | void setup(){ 23 | Serial.begin(115200); 24 | ticker.schedule(1000, &hallo, millis()+2000, millis()+10000); 25 | 26 | auto lambda = [](void*) { Serial.println("hallo from lambda"); }; 27 | ticker.schedule(10000, lambda); 28 | } 29 | 30 | void loop(){ 31 | ticker.doLoop(); 32 | delay(100); 33 | } -------------------------------------------------------------------------------- /docs/html/search/all_d.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['parse_0',['parse',['../classtinyhttp_1_1_http_parameters.html#ac9f4de64ca24b13001a6bff814e3e1b1',1,'tinyhttp::HttpParameters::parse(Stream &in)'],['../classtinyhttp_1_1_http_parameters.html#ac95be768ed42931f021477e11369e6b3',1,'tinyhttp::HttpParameters::parse(Stream &in, void(*callback)(const char *key, const char *value))']]], 4 | ['processextensions_1',['processExtensions',['../classtinyhttp_1_1_http_server.html#a3d08f7da72f29f2f5604277540f45865',1,'tinyhttp::HttpServer']]], 5 | ['put_2',['put',['../classtinyhttp_1_1_http_header.html#a522309340aa1521b8d54ad69849c65ae',1,'tinyhttp::HttpHeader::put(const char *key, int value)'],['../classtinyhttp_1_1_http_header.html#af03d06efa84b158bb0b19b3c7c11b3b4',1,'tinyhttp::HttpHeader::put(const char *line)']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /docs/html/search/functions_d.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['parse_0',['parse',['../classtinyhttp_1_1_http_parameters.html#ac9f4de64ca24b13001a6bff814e3e1b1',1,'tinyhttp::HttpParameters::parse(Stream &in)'],['../classtinyhttp_1_1_http_parameters.html#ac95be768ed42931f021477e11369e6b3',1,'tinyhttp::HttpParameters::parse(Stream &in, void(*callback)(const char *key, const char *value))']]], 4 | ['processextensions_1',['processExtensions',['../classtinyhttp_1_1_http_server.html#a3d08f7da72f29f2f5604277540f45865',1,'tinyhttp::HttpServer']]], 5 | ['put_2',['put',['../classtinyhttp_1_1_http_header.html#a522309340aa1521b8d54ad69849c65ae',1,'tinyhttp::HttpHeader::put(const char *key, int value)'],['../classtinyhttp_1_1_http_header.html#af03d06efa84b158bb0b19b3c7c11b3b4',1,'tinyhttp::HttpHeader::put(const char *line)']]] 6 | ]; 7 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: philschatzh 14 | custom: ['https://www.paypal.com/paypalme/pschatzmann?country.x=CH&locale.x=en_US'] -------------------------------------------------------------------------------- /docs/html/search/mag.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 12 | 14 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /docs/html/search/mag_d.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 12 | 14 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /docs/html/search/classes_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['extension_0',['Extension',['../classtinyhttp_1_1_extension.html',1,'tinyhttp']]], 4 | ['extensionesptask_1',['ExtensionESPTask',['../classtinyhttp_1_1_extension_e_s_p_task.html',1,'tinyhttp']]], 5 | ['extensionloggingstream_2',['ExtensionLoggingStream',['../classtinyhttp_1_1_extension_logging_stream.html',1,'tinyhttp']]], 6 | ['extensionmusicfilestream_3',['ExtensionMusicFileStream',['../classtinyhttp_1_1_extension_music_file_stream.html',1,'tinyhttp']]], 7 | ['extensionsd_4',['ExtensionSD',['../classtinyhttp_1_1_extension_s_d.html',1,'tinyhttp']]], 8 | ['extensionsdstreamed_5',['ExtensionSDStreamed',['../classtinyhttp_1_1_extension_s_d_streamed.html',1,'tinyhttp']]], 9 | ['extensionstream_6',['ExtensionStream',['../classtinyhttp_1_1_extension_stream.html',1,'tinyhttp']]], 10 | ['extensionstreambasic_7',['ExtensionStreamBasic',['../classtinyhttp_1_1_extension_stream_basic.html',1,'tinyhttp']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /docs/html/search/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 12 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /docs/html/search/classes_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['list_0',['List',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 4 | ['list_3c_20tinyhttp_3a_3aextension_20_2a_20_3e_1',['List< tinyhttp::Extension * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 5 | ['list_3c_20tinyhttp_3a_3ahttpheaderline_20_2a_20_3e_2',['List< tinyhttp::HttpHeaderLine * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 6 | ['list_3c_20tinyhttp_3a_3ahttprequesthandlerline_20_2a_20_3e_3',['List< tinyhttp::HttpRequestHandlerLine * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 7 | ['list_3c_20tinyhttp_3a_3ahttprequestrewrite_20_2a_20_3e_4',['List< tinyhttp::HttpRequestRewrite * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 8 | ['list_3c_20tinyhttp_3a_3ahttpstreamcopy_20_2a_20_3e_5',['List< tinyhttp::HttpStreamCopy * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 9 | ['list_3c_20tinyhttp_3a_3awificlient_20_3e_6',['List< tinyhttp::WiFiClient >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /examples/zany_experiments/serverWebCopy/serverWebCopy.ino: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @file serverDump.ino 4 | * @author SSID (phil.schatzmann@gmail.com) 5 | * @brief We start a Webserver which serves the pages from a SD card and which also supports the download of an external 6 | * website to the SD. 7 | * @version 0.1 8 | * @date 2020-11-30 9 | * 10 | * @copyright Copyright (c) 2020 11 | * 12 | */ 13 | 14 | #include 15 | #include "HttpServer.h" 16 | #include "Extensions/ExtensionWebCopy.h" 17 | 18 | using namespace tinyhttp; 19 | 20 | WiFiServer wifi; 21 | HttpServer server(wifi); 22 | Extension sd = ExtensionWebCopy("https://www.pschatzmann.ch/home/", true); 23 | 24 | void setup() { 25 | Serial.begin(115200); 26 | // connect to WIFI 27 | WiFi.begin("network name", "password"); 28 | while (WiFi.status() != WL_CONNECTED) { 29 | delay(500); 30 | Serial.print("."); 31 | } 32 | 33 | server.addExtension(sd); 34 | server.begin(80); 35 | 36 | } 37 | 38 | void loop(){ 39 | server.doLoop(); 40 | } -------------------------------------------------------------------------------- /src/Server/HttpChunkWriter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Client.h" 4 | #include "Server/HttpLogger.h" 5 | 6 | namespace tinyhttp { 7 | 8 | /** 9 | * @brief Writes the data chunked to the actual client 10 | * 11 | */ 12 | class HttpChunkWriter { 13 | public: 14 | int writeChunk(Client &client, const char* str, int len, const char* str1=nullptr, int len1=0){ 15 | HttpLogger.log(Debug,"HttpChunkWriter","writeChunk"); 16 | client.println(len+len1, HEX); 17 | int result = client.write((uint8_t*)str, len); 18 | if (str1!=nullptr){ 19 | result += client.write((uint8_t*)str1, len1); 20 | } 21 | client.println(); 22 | return result; 23 | } 24 | 25 | int writeChunk(Client &client, const char* str){ 26 | int len = strlen(str); 27 | return writeChunk(client, str, len); 28 | } 29 | 30 | void writeEnd(Client &client){ 31 | writeChunk(client, "",0); 32 | } 33 | 34 | }; 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_10.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['tobinary_0',['toBinary',['../classtinyhttp_1_1_str_view.html#a938f6009e0ff6599d6158d5123d33d87',1,'tinyhttp::StrView']]], 4 | ['todouble_1',['toDouble',['../classtinyhttp_1_1_str_view.html#a5ec9c26e9ca076e7c64726dbb548b2b7',1,'tinyhttp::StrView']]], 5 | ['tofloat_2',['toFloat',['../classtinyhttp_1_1_str_view.html#aa160aeaa7d73829c52335b3f3178bf16',1,'tinyhttp::StrView']]], 6 | ['toint_3',['toInt',['../classtinyhttp_1_1_str_view.html#a433f8af22c342bbbe2796cd2e2404d74',1,'tinyhttp::StrView']]], 7 | ['tolong_4',['toLong',['../classtinyhttp_1_1_str_view.html#afe50b40a2ea33607b5683a3d34088335',1,'tinyhttp::StrView']]], 8 | ['tolowercase_5',['toLowerCase',['../classtinyhttp_1_1_str_view.html#a558d8e998156715d89a30e72c08c5243',1,'tinyhttp::StrView']]], 9 | ['touppercase_6',['toUpperCase',['../classtinyhttp_1_1_str_view.html#a540d078c88102e6a159810168c5456d2',1,'tinyhttp::StrView']]], 10 | ['trim_7',['trim',['../classtinyhttp_1_1_str_view.html#a37d1c06cd48faa67897246a4bc3ed078',1,'tinyhttp::StrView']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /docs/html/search/all_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['get_0',['get',['../classtinyhttp_1_1_http_tunnel.html#a66037e28488087a07ce4b4d57005beb7',1,'tinyhttp::HttpTunnel']]], 4 | ['getfloat_1',['getFloat',['../classtinyhttp_1_1_http_parameters.html#a7fa1709c32e56ae1b14f4055c7c52cb2',1,'tinyhttp::HttpParameters']]], 5 | ['getint_2',['getInt',['../classtinyhttp_1_1_http_parameters.html#a87a0c7a75b91cd7494568d233a100a2d',1,'tinyhttp::HttpParameters']]], 6 | ['getmime_3',['getMime',['../classtinyhttp_1_1_mime_resolver.html#ad421ec518c7df7a84a556ae9b2d2ceab',1,'tinyhttp::MimeResolver']]], 7 | ['getparameter_4',['getParameter',['../classtinyhttp_1_1_http_parameters.html#a5c28a702ec0d3d1fbb498a7caacb19dc',1,'tinyhttp::HttpParameters']]], 8 | ['getvalue_5',['getValue',['../classtinyhttp_1_1_http_parameters.html#a51485d62c039686cc40856018b5785f6',1,'tinyhttp::HttpParameters']]], 9 | ['grow_6',['grow',['../classtinyhttp_1_1_str.html#a432d27a0b5128e6fcb5efa667ee42b91',1,'tinyhttp::Str::grow()'],['../classtinyhttp_1_1_str_view.html#adfe4df3c205dea25d63e3d99d2c1316d',1,'tinyhttp::StrView::grow()']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /docs/html/search/functions_6.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['get_0',['get',['../classtinyhttp_1_1_http_tunnel.html#a66037e28488087a07ce4b4d57005beb7',1,'tinyhttp::HttpTunnel']]], 4 | ['getfloat_1',['getFloat',['../classtinyhttp_1_1_http_parameters.html#a7fa1709c32e56ae1b14f4055c7c52cb2',1,'tinyhttp::HttpParameters']]], 5 | ['getint_2',['getInt',['../classtinyhttp_1_1_http_parameters.html#a87a0c7a75b91cd7494568d233a100a2d',1,'tinyhttp::HttpParameters']]], 6 | ['getmime_3',['getMime',['../classtinyhttp_1_1_mime_resolver.html#ad421ec518c7df7a84a556ae9b2d2ceab',1,'tinyhttp::MimeResolver']]], 7 | ['getparameter_4',['getParameter',['../classtinyhttp_1_1_http_parameters.html#a5c28a702ec0d3d1fbb498a7caacb19dc',1,'tinyhttp::HttpParameters']]], 8 | ['getvalue_5',['getValue',['../classtinyhttp_1_1_http_parameters.html#a51485d62c039686cc40856018b5785f6',1,'tinyhttp::HttpParameters']]], 9 | ['grow_6',['grow',['../classtinyhttp_1_1_str.html#a432d27a0b5128e6fcb5efa667ee42b91',1,'tinyhttp::Str::grow()'],['../classtinyhttp_1_1_str_view.html#adfe4df3c205dea25d63e3d99d2c1316d',1,'tinyhttp::StrView::grow()']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /docs/html/search/mag_sel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 13 | 15 | 21 | 26 | 31 | 32 | -------------------------------------------------------------------------------- /docs/html/search/mag_seld.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 13 | 15 | 21 | 26 | 31 | 32 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Works with 3.11 and tested through 3.19 2 | cmake_minimum_required(VERSION 3.11...3.19) 3 | 4 | # Project name and a few useful settings. Other commands can pick up the results 5 | project( 6 | TinyHttp 7 | VERSION 0.1 8 | DESCRIPTION "TinyHttp (Arduino) Library" 9 | LANGUAGES CXX) 10 | 11 | include(FetchContent) 12 | 13 | add_definitions(-DPLATFORM_LINUX) 14 | 15 | # Build with Linux Arduino Emulator 16 | FetchContent_Declare(arduino_emulator GIT_REPOSITORY "https://github.com/pschatzmann/Arduino-Emulator.git" GIT_TAG main ) 17 | FetchContent_GetProperties(arduino_emulator) 18 | if(NOT arduino_emulator_POPULATED) 19 | FetchContent_Populate(arduino_emulator) 20 | add_subdirectory(${arduino_emulator_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/emulator) 21 | endif() 22 | 23 | # The compiled library code is here 24 | add_subdirectory(src) 25 | 26 | 27 | # Testing only available if this is the main app 28 | # Emergency override MODERN_CMAKE_BUILD_TESTING provided as well 29 | #if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MODERN_CMAKE_BUILD_TESTING) 30 | # AND BUILD_TESTING) 31 | # add_subdirectory(tests) 32 | #endif() 33 | -------------------------------------------------------------------------------- /docs/html/search/functions_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['add_0',['add',['../classtinyhttp_1_1_str_view.html#a32310d03fd4520279101760e28fb6205',1,'tinyhttp::StrView::add(int value)'],['../classtinyhttp_1_1_str_view.html#a7943b243a80a4680f9701ac7b4fa7cd1',1,'tinyhttp::StrView::add(double value, int precision=2, int withd=0)'],['../classtinyhttp_1_1_str_view.html#a537d693040b0f46e3bcbcbceaa2ffaa0',1,'tinyhttp::StrView::add(const char *append)'],['../classtinyhttp_1_1_str_view.html#a328ae311ddaa88a24bb043c32eebb833',1,'tinyhttp::StrView::add(const char c)']]], 4 | ['addextension_1',['addExtension',['../classtinyhttp_1_1_http_server.html#a9502b9f2c31bbe6e78ee5dcb6c00c439',1,'tinyhttp::HttpServer']]], 5 | ['addhandler_2',['addHandler',['../classtinyhttp_1_1_http_server.html#aa1f45b4e3eec52076a4f167e23777de2',1,'tinyhttp::HttpServer']]], 6 | ['addhistory_3',['addHistory',['../classtinyhttp_1_1_http_streamed_multi_output.html#ae587d217e85483f9472ab76437982e07',1,'tinyhttp::HttpStreamedMultiOutput']]], 7 | ['availableforwrite_4',['availableForWrite',['../classtinyhttp_1_1_http_streamed_multi_output.html#ac8df95099ebb027e0ea98fe20afe3a1e',1,'tinyhttp::HttpStreamedMultiOutput']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Server/HttpTunnel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Server/Url.h" 3 | #include "Server/HttpRequest.h" 4 | 5 | namespace tinyhttp { 6 | 7 | /** 8 | * @brief Forwards a request to a destination URL and provides a pointer to the result stream 9 | * 10 | */ 11 | class HttpTunnel { 12 | public: 13 | HttpTunnel(const char* url, const char* mime="text/html"){ 14 | HttpLogger.log(Info,"HttpTunnel: %s", url); 15 | v_url.setUrl(url); 16 | v_mime = mime; 17 | } 18 | 19 | /// Executes the get request 20 | Stream *get() { 21 | HttpLogger.log(Info,"HttpTunnel::get"); 22 | if (isOk(v_request.get(v_url, v_mime))){ 23 | return v_request.client(); 24 | } 25 | return nullptr; 26 | } 27 | 28 | HttpRequest& request() { 29 | return v_request; 30 | } 31 | 32 | const char *mime() { 33 | return v_mime; 34 | } 35 | 36 | 37 | protected: 38 | Url v_url; 39 | HttpRequest v_request; 40 | const char* v_mime; 41 | 42 | bool isOk(int code){ 43 | return code>=200 && code<300; 44 | } 45 | 46 | }; 47 | 48 | } -------------------------------------------------------------------------------- /examples/serverLog/serverLog.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * @file serverLoggingStream.ino 3 | * @author Phil Schatzmann 4 | * @brief Instead of logging messages to serial you can log them to the Server! 5 | * @version 0.1 6 | * @date 2022-09-03 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | 12 | #include "HttpServer.h" 13 | #include "HttpExtensions.h" 14 | 15 | const char* ssid = "SSID"; 16 | const char* password = "PASSWORD"; 17 | WiFiServer wifi; 18 | HttpServer server(wifi); 19 | ExtensionLoggingStream logger("/"); 20 | Ticker ticker; 21 | 22 | void printMsg(void*){ 23 | static int count; 24 | char str[20]; 25 | sprintf(str,"counter: %d",count++); 26 | // log to server 27 | logger.println(str); 28 | // log to serial 29 | Serial.println(str); 30 | } 31 | 32 | void setup() { 33 | Serial.begin(115200); 34 | // connect to WIFI 35 | HttpLogger.begin(Serial,Info); 36 | 37 | // generate test messages every second 38 | ticker.schedule(1000,&printMsg); 39 | 40 | // register logger extension and start server 41 | server.addExtension(logger); 42 | server.begin(80, ssid, password); 43 | 44 | } 45 | 46 | void loop(){ 47 | server.doLoop(); 48 | ticker.doLoop(); 49 | } -------------------------------------------------------------------------------- /docs/html/search/functions_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['c_5fstr_0',['c_str',['../classtinyhttp_1_1_str_view.html#ae429db498e62aaf57fb515158493e1f4',1,'tinyhttp::StrView']]], 4 | ['clear_1',['clear',['../classtinyhttp_1_1_str.html#a0712236e01bae439c252d40da0a81e15',1,'tinyhttp::Str::clear()'],['../classtinyhttp_1_1_str_view.html#a8da95c13011169c4a7cd60586ecb0a50',1,'tinyhttp::StrView::clear()'],['../classtinyhttp_1_1_http_header.html#a5e669a6030351f571aa9e38032c814f0',1,'tinyhttp::HttpHeader::clear()'],['../classtinyhttp_1_1_http_parameters.html#a2c25154be4367d9bc24ff31938744957',1,'tinyhttp::HttpParameters::clear()']]], 5 | ['client_2',['client',['../classtinyhttp_1_1_http_server.html#a383e121d7dffb4c8b63f7a485f678195',1,'tinyhttp::HttpServer']]], 6 | ['contains_3',['contains',['../classtinyhttp_1_1_str_view.html#ac85d7368c37c2e0f6f12377d681c241e',1,'tinyhttp::StrView']]], 7 | ['copy_4',['copy',['../classtinyhttp_1_1_http_server.html#a40bbe1d2254018a35d0ae381e6139fe2',1,'tinyhttp::HttpServer']]], 8 | ['count_5',['count',['../classtinyhttp_1_1_str_view.html#afb0f669ff8262f1e6509cd7d3c16e455',1,'tinyhttp::StrView']]], 9 | ['crlf_6',['crlf',['../classtinyhttp_1_1_http_server.html#a6b62c48ab2c6a065d4b96a63d4181816',1,'tinyhttp::HttpServer']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /examples/serverWithTask/serverWithTask.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * @file server.ino 3 | * @author SSID (phil.schatzmann@gmail.com) 4 | * @brief We start a Webserver. No processing is required in the loop! 5 | * @version 0.1 6 | * @date 2020-11-30 7 | * 8 | * @copyright Copyright (c) 2020 9 | * 10 | */ 11 | 12 | #include "HttpServer.h" 13 | #include "HttpExtensions.h" 14 | 15 | const char* ssid = "SSID"; 16 | const char* password = "PASSWORD"; 17 | WiFiServer wifi; 18 | HttpServer server(wifi); 19 | ExtensionESPTask task; // calls server.doLoop(); in an ESP32 task 20 | 21 | void setup() { 22 | Serial.begin(115200); 23 | // connect to WIFI 24 | HttpLogger.begin(Serial,Info); 25 | 26 | const char*htmlHallo = 27 | "" 28 | "" 29 | "" 30 | "

Arduino Http Server

" 31 | "

Hallo world...

" 32 | "" 33 | ""; 34 | 35 | // define urls 36 | server.rewrite("/","/hallo.html"); 37 | server.rewrite("/index.html","/hallo.html"); 38 | server.on("/hallo.html",T_GET,"text/html",htmlHallo); 39 | 40 | // start server with task 41 | server.addExtension(task); 42 | server.begin(80, ssid, password); 43 | 44 | } 45 | 46 | void loop(){ 47 | } -------------------------------------------------------------------------------- /src/Server/HttpStreamedOutput.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "WiFi.h" 4 | 5 | namespace tinyhttp { 6 | 7 | /** 8 | * @brief Abstract class for handling streamed output 9 | * 10 | */ 11 | 12 | class HttpStreamedOutput { 13 | public: 14 | // provides the mime type 15 | virtual const char* mime() = 0; 16 | 17 | // checks if the client is valid 18 | virtual bool isValid(WiFiClient &client) = 0; 19 | 20 | // content that is written when the request is opened 21 | virtual void open(WiFiClient &client) = 0; 22 | 23 | // checks if we have any open clients 24 | virtual bool isOpen() = 0; 25 | 26 | // end processing by wr 27 | virtual void close() = 0; 28 | 29 | // write the content to the HttpStreamedMultiOutput 30 | virtual size_t write( uint8_t *content, int len) = 0; 31 | 32 | // writes a line 33 | virtual size_t print(const char* str) = 0; 34 | 35 | // writes a line which terminates with a html line break 36 | virtual size_t println(const char* str) = 0; 37 | 38 | // release memory 39 | virtual void cleanup() = 0; 40 | 41 | // actually we do nothing here - but some subclasses might 42 | virtual void doLoop() = 0; 43 | }; 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /docs/html/search/all_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['c_5fstr_0',['c_str',['../classtinyhttp_1_1_str_view.html#ae429db498e62aaf57fb515158493e1f4',1,'tinyhttp::StrView']]], 4 | ['clear_1',['clear',['../classtinyhttp_1_1_str.html#a0712236e01bae439c252d40da0a81e15',1,'tinyhttp::Str::clear()'],['../classtinyhttp_1_1_str_view.html#a8da95c13011169c4a7cd60586ecb0a50',1,'tinyhttp::StrView::clear()'],['../classtinyhttp_1_1_http_header.html#a5e669a6030351f571aa9e38032c814f0',1,'tinyhttp::HttpHeader::clear()'],['../classtinyhttp_1_1_http_parameters.html#a2c25154be4367d9bc24ff31938744957',1,'tinyhttp::HttpParameters::clear()']]], 5 | ['client_2',['client',['../classtinyhttp_1_1_client.html',1,'tinyhttp::Client'],['../classtinyhttp_1_1_http_server.html#a383e121d7dffb4c8b63f7a485f678195',1,'tinyhttp::HttpServer::client()']]], 6 | ['contains_3',['contains',['../classtinyhttp_1_1_str_view.html#ac85d7368c37c2e0f6f12377d681c241e',1,'tinyhttp::StrView']]], 7 | ['copy_4',['copy',['../classtinyhttp_1_1_http_server.html#a40bbe1d2254018a35d0ae381e6139fe2',1,'tinyhttp::HttpServer']]], 8 | ['count_5',['count',['../classtinyhttp_1_1_str_view.html#afb0f669ff8262f1e6509cd7d3c16e455',1,'tinyhttp::StrView']]], 9 | ['crlf_6',['crlf',['../classtinyhttp_1_1_http_server.html#a6b62c48ab2c6a065d4b96a63d4181816',1,'tinyhttp::HttpServer']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /docs/html/search/functions_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['lastindexof_0',['lastIndexOf',['../classtinyhttp_1_1_str_view.html#adc4a4a3e39d86eb7888053ae1c1882a2',1,'tinyhttp::StrView']]], 4 | ['length_1',['length',['../classtinyhttp_1_1_str_view.html#a0ce3829ef2304731db3c777f60263ee4',1,'tinyhttp::StrView']]], 5 | ['list_2',['list',['../classtinyhttp_1_1_list.html#a847d46a4463e62f662e7945adcaf9a1c',1,'tinyhttp::List::List()'],['../classtinyhttp_1_1_list.html#a5f82365d7e691f13d91df58103937712',1,'tinyhttp::List::List(const List &ref)=default'],['../classtinyhttp_1_1_list.html#a3f46b947d78875298b1988a41370ffcd',1,'tinyhttp::List::List(const T(&a)[N])']]], 6 | ['localhost_3',['localHost',['../classtinyhttp_1_1_http_server.html#a7b66f3ae2446ba90a31b4bedc99310ec',1,'tinyhttp::HttpServer']]], 7 | ['localip_4',['localIP',['../classtinyhttp_1_1_http_server.html#a43b1773580c00cf847f78753177234bb',1,'tinyhttp::HttpServer']]], 8 | ['log_5',['log',['../classtinyhttp_1_1_http_logger_class.html#a8bd88841bae9816af7240a3706e8512e',1,'tinyhttp::HttpLoggerClass']]], 9 | ['login_6',['login',['../classtinyhttp_1_1_http_server.html#a50bd62d94267038636140056f7f702e6',1,'tinyhttp::HttpServer']]], 10 | ['ltrim_7',['ltrim',['../classtinyhttp_1_1_str_view.html#a4e73a014165e6afaacc1db2f37ace81d',1,'tinyhttp::StrView']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /src/Server/HttpRequestHandlerLine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Server/HttpHeader.h" 4 | 5 | namespace tinyhttp { 6 | 7 | 8 | // forward declarations for the callback 9 | class HttpServer; 10 | class HttpRequestHandlerLine; 11 | 12 | // Callback function which provides result 13 | typedef void (*web_callback_fn)(HttpServer *server, const char* requestPath, HttpRequestHandlerLine *handlerLine); 14 | 15 | /** 16 | * @brief Used to register and process callbacks 17 | * 18 | */ 19 | class HttpRequestHandlerLine { 20 | public: 21 | HttpRequestHandlerLine(int ctxSize=0){ 22 | HttpLogger.log(Info,"HttpRequestHandlerLine"); 23 | contextCount = ctxSize; 24 | context = new void*[ctxSize]; 25 | } 26 | 27 | ~HttpRequestHandlerLine(){ 28 | HttpLogger.log(Info,"~HttpRequestHandlerLine"); 29 | if (contextCount>0){ 30 | HttpLogger.log(Info,"HttpRequestHandlerLine %s","free"); 31 | delete[] context; 32 | } 33 | } 34 | 35 | TinyMethodID method; 36 | const char* path = nullptr; 37 | const char* mime = nullptr; 38 | web_callback_fn fn; 39 | void** context; 40 | int contextCount; 41 | StrView *header = nullptr; 42 | }; 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------------------------- 2 | # CMake definition for stand alone linux build 3 | # 4 | # Copyright (c) 2020 SSID 5 | 6 | 7 | # Note that headers are optional, and do not affect add_library, but they will not 8 | # show up in IDEs unless they are listed in add_library. 9 | 10 | # glob, but only for CMake 3.12 or later: 11 | file(GLOB_RECURSE HEADER_LIST CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.h") 12 | file(GLOB_RECURSE SRC_LIST CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.cpp") 13 | # set(HEADER_LIST "${TinyPPP_SOURCE_DIR}/include/modern/lib.hpp") 14 | 15 | # Make an automatic library - will be static or dynamic based on user setting 16 | add_library(tinyhttp_library ${SRC_LIST} ${HEADER_LIST}) 17 | 18 | # We need this directory, and users of our library will need it too 19 | target_include_directories(tinyhttp_library PUBLIC ../src) 20 | 21 | # This depends on (header only) boost 22 | # target_link_libraries(tinyhttp_library PRIVATE Boost::boost) 23 | 24 | # All users of this library will need at least C++11 25 | target_compile_features(tinyhttp_library PUBLIC cxx_std_11) 26 | 27 | # IDEs should put the headers in a nice place 28 | source_group( 29 | TREE "${PROJECT_SOURCE_DIR}/src" 30 | PREFIX "Header Files" 31 | FILES ${HEADER_LIST}) 32 | -------------------------------------------------------------------------------- /docs/html/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['add_0',['add',['../classtinyhttp_1_1_str_view.html#a32310d03fd4520279101760e28fb6205',1,'tinyhttp::StrView::add(int value)'],['../classtinyhttp_1_1_str_view.html#a7943b243a80a4680f9701ac7b4fa7cd1',1,'tinyhttp::StrView::add(double value, int precision=2, int withd=0)'],['../classtinyhttp_1_1_str_view.html#a537d693040b0f46e3bcbcbceaa2ffaa0',1,'tinyhttp::StrView::add(const char *append)'],['../classtinyhttp_1_1_str_view.html#a328ae311ddaa88a24bb043c32eebb833',1,'tinyhttp::StrView::add(const char c)']]], 4 | ['addextension_1',['addExtension',['../classtinyhttp_1_1_http_server.html#a9502b9f2c31bbe6e78ee5dcb6c00c439',1,'tinyhttp::HttpServer']]], 5 | ['addhandler_2',['addHandler',['../classtinyhttp_1_1_http_server.html#aa1f45b4e3eec52076a4f167e23777de2',1,'tinyhttp::HttpServer']]], 6 | ['addhistory_3',['addHistory',['../classtinyhttp_1_1_http_streamed_multi_output.html#ae587d217e85483f9472ab76437982e07',1,'tinyhttp::HttpStreamedMultiOutput']]], 7 | ['altarduino_2eh_4',['AltArduino.h',['../_alt_arduino_8h.html',1,'']]], 8 | ['arduino_5',['Installation in Arduino',['../index.html#autotoc_md6',1,'']]], 9 | ['availableforwrite_6',['availableForWrite',['../classtinyhttp_1_1_http_streamed_multi_output.html#ac8df95099ebb027e0ea98fe20afe3a1e',1,'tinyhttp::HttpStreamedMultiOutput']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /docs/html/search/all_10.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['ticker_0',['Ticker',['../classtinyhttp_1_1_ticker.html',1,'tinyhttp']]], 4 | ['tickerentry_1',['TickerEntry',['../structtinyhttp_1_1_ticker_entry.html',1,'tinyhttp']]], 5 | ['tinyhttp_20media_20server_2',['TinyHttp (Media) Server',['../index.html',1,'']]], 6 | ['tobinary_3',['toBinary',['../classtinyhttp_1_1_str_view.html#a938f6009e0ff6599d6158d5123d33d87',1,'tinyhttp::StrView']]], 7 | ['todouble_4',['toDouble',['../classtinyhttp_1_1_str_view.html#a5ec9c26e9ca076e7c64726dbb548b2b7',1,'tinyhttp::StrView']]], 8 | ['tofloat_5',['toFloat',['../classtinyhttp_1_1_str_view.html#aa160aeaa7d73829c52335b3f3178bf16',1,'tinyhttp::StrView']]], 9 | ['toint_6',['toInt',['../classtinyhttp_1_1_str_view.html#a433f8af22c342bbbe2796cd2e2404d74',1,'tinyhttp::StrView']]], 10 | ['tolong_7',['toLong',['../classtinyhttp_1_1_str_view.html#afe50b40a2ea33607b5683a3d34088335',1,'tinyhttp::StrView']]], 11 | ['tolowercase_8',['toLowerCase',['../classtinyhttp_1_1_str_view.html#a558d8e998156715d89a30e72c08c5243',1,'tinyhttp::StrView']]], 12 | ['touppercase_9',['toUpperCase',['../classtinyhttp_1_1_str_view.html#a540d078c88102e6a159810168c5456d2',1,'tinyhttp::StrView']]], 13 | ['trim_10',['trim',['../classtinyhttp_1_1_str_view.html#a37d1c06cd48faa67897246a4bc3ed078',1,'tinyhttp::StrView']]] 14 | ]; 15 | -------------------------------------------------------------------------------- /examples/serverPostMP3/serverPostMP3.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * A simple http server which plays an mp3 file that is posted. 3 | * Test e.g. with curl -F "file=@test.mp3;type=audio/mp3" -X POST http://192.168.1.33/play 4 | * 5 | */ 6 | 7 | #include "AudioTools.h" 8 | #include "AudioCodecs/CodecMP3Helix.h" 9 | #include "AudioLibs/AudioKit.h" 10 | #include "HttpServer.h" 11 | 12 | AudioKitStream i2s; // final output of decoded stream 13 | EncodedAudioStream dec(&i2s, new MP3DecoderHelix()); // Decoding stream 14 | StreamCopy copier; 15 | 16 | const char *ssid = "SSID"; 17 | const char *password = "PASSWORD"; 18 | WiFiServer wifi; 19 | HttpServer server(wifi); 20 | 21 | void setup() { 22 | Serial.begin(115200); 23 | AudioLogger::instance().begin(Serial, AudioLogger::Info); 24 | HttpLogger.begin(Serial, tinyhttp::Debug); 25 | 26 | dec.begin(); 27 | i2s.begin(); 28 | 29 | auto playMP3 = [](HttpServer *server_ptr, const char *requestPath, 30 | HttpRequestHandlerLine *hl) { 31 | LOGI("Playing mp3"); 32 | copier.begin(dec, server_ptr->client()); 33 | copier.copyAll(); 34 | server_ptr->replyOK(); 35 | }; 36 | 37 | server.on("/play", T_POST, playMP3); 38 | server.begin(80, ssid, password); 39 | HttpLogger.log(tinyhttp::Info, "server was started..."); 40 | } 41 | 42 | void loop() { server.doLoop(); } -------------------------------------------------------------------------------- /examples/serverStream/serverStream.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * @file serverStream.ino 3 | * @author Phil Schatzmann 4 | * @brief Instead of logging messages to serial you can log them to the Server! 5 | * @version 0.1 6 | * @date 2022-09-03 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | 12 | #include "HttpServer.h" 13 | #include "HttpExtensions.h" 14 | 15 | // setup server 16 | const char* ssid = "SSID"; 17 | const char* password = "PASSWORD"; 18 | WiFiServer wifi; 19 | HttpServer server(wifi); 20 | const char* htmlHeader = "

Streaming Example

"; 21 | const char* htmlEnd = ""; 22 | const char* mime = "text/html"; 23 | ExtensionStream stream("/",T_GET, mime, htmlHeader, htmlEnd ); 24 | Ticker ticker; 25 | 26 | 27 | void setup() { 28 | Serial.begin(115200); 29 | HttpLogger.begin(Serial,Info); 30 | 31 | server.addExtension(stream); 32 | server.begin(80, ssid, password); 33 | 34 | // generate test messages 35 | ticker.schedule(1000,&printMsg); 36 | 37 | } 38 | 39 | void printMsg(void*){ 40 | static int count; 41 | char str[20]; 42 | sprintf(str,"counter: %d",count++); 43 | // log to server 44 | stream.println((const char*) str); 45 | // log to serial 46 | Serial.println(str); 47 | } 48 | 49 | void loop(){ 50 | server.doLoop(); 51 | ticker.doLoop(); 52 | } -------------------------------------------------------------------------------- /examples/webservice/webservice/webservice.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * @file webservice 3 | * @author Phil Schatzmann 4 | * @brief A very simple webservice that is providing the result as json 5 | * @version 0.1 6 | * @date 2022-10-05 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #include "HttpServer.h" 12 | #include "ArduinoJson.h" 13 | 14 | // json parameters 15 | float volumeControl = 1.0; 16 | int16_t clipThreashold = 4990; 17 | float fuzzEffectValue = 6.5; 18 | 19 | // Server 20 | WiFiServer wifi; 21 | HttpServer server(wifi); 22 | const char *ssid = "SSID"; 23 | const char *password = "password"; 24 | 25 | 26 | // Arduino Setup 27 | void setup(void) { 28 | Serial.begin(115200); 29 | HttpLogger.begin(Serial, Warning); 30 | 31 | auto getJson = [](HttpServer *server, const char*requestPath, HttpRequestHandlerLine *hl) { 32 | // reply using callback 33 | const int max_len = 160; 34 | char json[max_len]; 35 | snprintf(json, max_len, "{volumeControl: %f, clipThreashold: %d, fuzzEffectValue: %f }", volumeControl, clipThreashold, fuzzEffectValue ); 36 | server->reply("text/json", json, 200); 37 | }; 38 | 39 | server.rewrite("/","/service"); 40 | server.on("/service",T_GET, getJson); 41 | server.begin(80, ssid, password); 42 | } 43 | 44 | // Arduino loop - copy data 45 | void loop() { 46 | server.copy(); 47 | } -------------------------------------------------------------------------------- /examples/zany_experiments/client/client.ino: -------------------------------------------------------------------------------- 1 | 2 | // example for the http T_GET request 3 | 4 | #include "HttpServer.h" 5 | 6 | #ifdef ARDUINO 7 | #include 8 | WiFiClientSecure client; 9 | #else 10 | WiFiClient client; 11 | #endif 12 | 13 | HttpRequest request(client); 14 | Url url("https://www.pschatzmann.ch/home/category/arduino/"); 15 | UrlExtractor urlExtractor("https://www.pschatzmann.ch"); 16 | 17 | uint8_t buffer[1024]; 18 | 19 | void setup() { 20 | Serial.begin(115200); 21 | HttpLogger.begin(Serial,Info); 22 | // connect to WIFI 23 | WiFi.begin("SSID", "password"); 24 | while (WiFi.status() != WL_CONNECTED) { 25 | delay(500); 26 | Serial.print("."); 27 | } 28 | 29 | // Connect to server 30 | request.get(url); 31 | 32 | // Print some result headers 33 | Serial.print("Status Code: "); 34 | Serial.println(request.reply().statusCode()); 35 | Serial.print("Status Message: "); 36 | Serial.println(request.reply().statusMessage()); 37 | Serial.print("Mime: "); 38 | Serial.println(request.reply().get(CONTENT_TYPE)); 39 | 40 | Serial.println("Result Data:"); 41 | while(request.available()>0){ 42 | // you can use read or readln 43 | int len = request.read(buffer, 1023); 44 | Serial.write(buffer, len); 45 | } 46 | 47 | Serial.println("DONE"); 48 | 49 | } 50 | 51 | void loop(){ 52 | 53 | } -------------------------------------------------------------------------------- /examples/serverMP3/serverMP3.ino: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @file serverMP3.ino 4 | * @author SSID (phil.schatzmann@gmail.com) 5 | * @brief We start a Webserver which streams MP3 files from a SD card. The same data is pushed to potentially multiple clients 6 | * @version 0.1 7 | * @date 2020-11-30 8 | * 9 | * @copyright Copyright (c) 2020 10 | * 11 | */ 12 | 13 | #include "HttpServer.h" 14 | #include "HttpExtensions.h" 15 | 16 | // I was using the AudioKit to test: It has quite some strange SD pin setup 17 | #define PIN_AUDIO_KIT_SD_CARD_CS 13 18 | #define PIN_AUDIO_KIT_SD_CARD_MISO 2 19 | #define PIN_AUDIO_KIT_SD_CARD_MOSI 15 20 | #define PIN_AUDIO_KIT_SD_CARD_CLK 14 21 | 22 | const char* ssid = "SSID"; 23 | const char* password = "PASSWORD"; 24 | WiFiServer wifi; 25 | HttpServer server(wifi); 26 | ExtensionMusicFileStream sdMp3("/music/mp3", "/TomWaits", "audio/mpeg", ".mp3", 512, PIN_AUDIO_KIT_SD_CARD_CS); 27 | 28 | void setup() { 29 | Serial.begin(115200); 30 | HttpLogger.begin(Serial, Info); 31 | 32 | // If you use custom pins for the CD drive: Comment out if you use the standard pins 33 | SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, PIN_AUDIO_KIT_SD_CARD_MOSI, PIN_AUDIO_KIT_SD_CARD_CS); 34 | 35 | server.rewrite("/","/music/mp3"); 36 | server.addExtension(sdMp3); 37 | server.begin(80, ssid, password); 38 | HttpLogger.log(Info,"server was started..."); 39 | 40 | } 41 | 42 | void loop(){ 43 | server.doLoop(); 44 | } -------------------------------------------------------------------------------- /docs/html/search/functions_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['indexof_0',['indexof',['../classtinyhttp_1_1_str_view.html#a4c4a257c90550afd78f39fa2b006257d',1,'tinyhttp::StrView::indexOf(const char c, int start=0)'],['../classtinyhttp_1_1_str_view.html#af1f3ca11990943eeaf89d1a124730097',1,'tinyhttp::StrView::indexOf(const char *cont, int start=0)']]], 4 | ['insert_1',['insert',['../classtinyhttp_1_1_str_view.html#aeb870c0e96a6a1cfd1991bfd97236aca',1,'tinyhttp::StrView']]], 5 | ['isconst_2',['isconst',['../classtinyhttp_1_1_str.html#ab10668531ccdea958e20a781e4a7b9c3',1,'tinyhttp::Str::isConst()'],['../classtinyhttp_1_1_str_view.html#a6e3e1ed9a43bff9ce553b5ccaa688f1b',1,'tinyhttp::StrView::isConst()']]], 6 | ['isempty_3',['isEmpty',['../classtinyhttp_1_1_str_view.html#ad0d56fad332fb5286a08506ea2588557',1,'tinyhttp::StrView']]], 7 | ['isinteger_4',['isInteger',['../classtinyhttp_1_1_str_view.html#ae21639b7070a069a7732e1d2927e2bda',1,'tinyhttp::StrView']]], 8 | ['isonheap_5',['isonheap',['../classtinyhttp_1_1_str.html#af69b3253999032e647b4339b686f6c4f',1,'tinyhttp::Str::isOnHeap()'],['../classtinyhttp_1_1_str_view.html#ae86287bc96863121461b591c4708a0da',1,'tinyhttp::StrView::isOnHeap()']]], 9 | ['isopen_6',['isOpen',['../classtinyhttp_1_1_extension_stream.html#a3318d9bb3ef5b5136909f8e8ddd6fbc5',1,'tinyhttp::ExtensionStream']]], 10 | ['isvalidstatus_7',['isValidStatus',['../classtinyhttp_1_1_http_header.html#a1c387a2f7d403263ac20f54cd7118fa8',1,'tinyhttp::HttpHeader']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /docs/html/doc.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/html/docd.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/html/search/functions_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['end_0',['end',['../classtinyhttp_1_1_http_server.html#ad7925a878b142d60e709f08b808851e7',1,'tinyhttp::HttpServer']]], 4 | ['endclient_1',['endClient',['../classtinyhttp_1_1_http_server.html#a5d63c8f7170d736f3623f6d9c99cc5aa',1,'tinyhttp::HttpServer']]], 5 | ['endswith_2',['endsWith',['../classtinyhttp_1_1_str_view.html#a1bf69de9877617a6a1e26c468826164b',1,'tinyhttp::StrView']]], 6 | ['endswithignorecase_3',['endsWithIgnoreCase',['../classtinyhttp_1_1_str_view.html#a162bd19032f76f19c6a5209630afd48b',1,'tinyhttp::StrView']]], 7 | ['equals_4',['equals',['../classtinyhttp_1_1_str_view.html#a60a91f6a21e5d374df56ae00de9d7f0a',1,'tinyhttp::StrView']]], 8 | ['equalsignorecase_5',['equalsIgnoreCase',['../classtinyhttp_1_1_str_view.html#a66aaf132965b8b599c1c20b1503229f0',1,'tinyhttp::StrView']]], 9 | ['extensionstream_6',['extensionstream',['../classtinyhttp_1_1_extension_stream.html#a50878efa957c51e0cccb1835e6576066',1,'tinyhttp::ExtensionStream::ExtensionStream(const char *url, TinyMethodID action, const char *mime, const char *startHtml=nullptr, const char *endHtml=nullptr, int bufferSize=256, int historySize=1024)'],['../classtinyhttp_1_1_extension_stream.html#ab031febbdb2bf855e8eb8ed5feea4e27',1,'tinyhttp::ExtensionStream::ExtensionStream(const char *url, const char *mime, Stream &source)']]], 10 | ['extensionstreambasic_7',['ExtensionStreamBasic',['../classtinyhttp_1_1_extension_stream_basic.html#aa233b1e82defe51a43b3b4b8027a77f6',1,'tinyhttp::ExtensionStreamBasic']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /docs/html/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_f.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/enums_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/files_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/classes_c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_a.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_b.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_f.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/namespaces_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
Loading...
13 |
14 | 19 |
Searching...
20 |
No Matches
21 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /src/Utils/MimeResolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Server/HttpCommon.h" 4 | 5 | namespace tinyhttp { 6 | 7 | /** 8 | * @brief Translates between file extensions and mime names 9 | * 10 | */ 11 | 12 | class MimeResolver { 13 | public: 14 | MimeResolver(){ 15 | } 16 | 17 | MimeResolver(MimeExtension *mime_extensions){ 18 | if (mime_extensions!=nullptr) 19 | setValues(mime_extensions); 20 | } 21 | 22 | void setValues(MimeExtension *mime_extensions){ 23 | this->mime_extensions = mime_extensions; 24 | } 25 | 26 | /// determines the mime type from the file extension 27 | virtual const char* getMime(const char* newName){ 28 | if (mime_extensions!=nullptr){ 29 | Str name(newName); 30 | for (int j=0; mime_extensions[j].mime != nullptr;j++){ 31 | if (name.endsWith(mime_extensions[j].extension)){ 32 | return mime_extensions[j].mime; 33 | } 34 | } 35 | } 36 | return nullptr; 37 | } 38 | 39 | virtual const char* getExtension(const char* mime){ 40 | Str mimeStr(mime); 41 | if (mime_extensions!=nullptr){ 42 | for (int j=0; mime_extensions[j].mime != nullptr;j++){ 43 | if (Str(mime_extensions[j].mime) == mimeStr){ 44 | return mime_extensions[j].extension; 45 | } 46 | } 47 | } 48 | return nullptr; 49 | } 50 | 51 | 52 | protected: 53 | const MimeExtension *mime_extensions = defaultMimeTable; 54 | 55 | }; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/Server/HttpStreamCopy.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Server/HttpChunkWriter.h" 4 | 5 | namespace tinyhttp { 6 | 7 | /** 8 | * @brief Processing of a single stream to a single client. 9 | * In the loop we can simply provide individual small chunks 10 | * until we are done. 11 | * 12 | * We work on a copy of the WiFiClient 13 | */ 14 | 15 | class HttpStreamCopy { 16 | public: 17 | HttpStreamCopy(Stream &input, WiFiClient &client, int outputSize=215){ 18 | this->is_open=true; 19 | this->input_ptr = &input; 20 | this->client_ptr = &client; 21 | this->output_size = outputSize; 22 | } 23 | 24 | ~HttpStreamCopy(){ 25 | close(); 26 | } 27 | 28 | bool isOpen(){ 29 | return is_open; 30 | } 31 | 32 | void doLoop(){ 33 | if (is_open) { 34 | char buffer[output_size]; 35 | if(input_ptr->available()>0 && client_ptr->connected()){ 36 | int len = input_ptr->readBytes(buffer, output_size); 37 | writer.writeChunk(*client_ptr, buffer, len); 38 | } else { 39 | close(); 40 | } 41 | } 42 | } 43 | 44 | protected: 45 | HttpChunkWriter writer; 46 | Stream *input_ptr; 47 | Client* client_ptr; 48 | int output_size; 49 | bool is_open; 50 | 51 | 52 | void close() { 53 | if (is_open){ 54 | is_open = false; 55 | //input_ptr->close(); 56 | writer.writeEnd(*client_ptr); 57 | client_ptr = nullptr; 58 | } 59 | } 60 | 61 | }; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /docs/html/search/all_8.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['in_20arduino_0',['Installation in Arduino',['../index.html#autotoc_md6',1,'']]], 4 | ['indexof_1',['indexof',['../classtinyhttp_1_1_str_view.html#a4c4a257c90550afd78f39fa2b006257d',1,'tinyhttp::StrView::indexOf(const char c, int start=0)'],['../classtinyhttp_1_1_str_view.html#af1f3ca11990943eeaf89d1a124730097',1,'tinyhttp::StrView::indexOf(const char *cont, int start=0)']]], 5 | ['insert_2',['insert',['../classtinyhttp_1_1_str_view.html#aeb870c0e96a6a1cfd1991bfd97236aca',1,'tinyhttp::StrView']]], 6 | ['installation_20in_20arduino_3',['Installation in Arduino',['../index.html#autotoc_md6',1,'']]], 7 | ['isconst_4',['isconst',['../classtinyhttp_1_1_str.html#ab10668531ccdea958e20a781e4a7b9c3',1,'tinyhttp::Str::isConst()'],['../classtinyhttp_1_1_str_view.html#a6e3e1ed9a43bff9ce553b5ccaa688f1b',1,'tinyhttp::StrView::isConst()']]], 8 | ['isempty_5',['isEmpty',['../classtinyhttp_1_1_str_view.html#ad0d56fad332fb5286a08506ea2588557',1,'tinyhttp::StrView']]], 9 | ['isinteger_6',['isInteger',['../classtinyhttp_1_1_str_view.html#ae21639b7070a069a7732e1d2927e2bda',1,'tinyhttp::StrView']]], 10 | ['isonheap_7',['isonheap',['../classtinyhttp_1_1_str.html#af69b3253999032e647b4339b686f6c4f',1,'tinyhttp::Str::isOnHeap()'],['../classtinyhttp_1_1_str_view.html#ae86287bc96863121461b591c4708a0da',1,'tinyhttp::StrView::isOnHeap()']]], 11 | ['isopen_8',['isOpen',['../classtinyhttp_1_1_extension_stream.html#a3318d9bb3ef5b5136909f8e8ddd6fbc5',1,'tinyhttp::ExtensionStream']]], 12 | ['isvalidstatus_9',['isValidStatus',['../classtinyhttp_1_1_http_header.html#a1c387a2f7d403263ac20f54cd7118fa8',1,'tinyhttp::HttpHeader']]], 13 | ['iterator_10',['iterator',['../classtinyhttp_1_1_list_1_1_iterator.html',1,'tinyhttp::List< T >::Iterator'],['../classtinyhttp_1_1_vector_1_1iterator.html',1,'tinyhttp::Vector< T >::iterator']]] 14 | ]; 15 | -------------------------------------------------------------------------------- /docs/html/search/classes_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['httpchunkreader_0',['HttpChunkReader',['../classtinyhttp_1_1_http_chunk_reader.html',1,'tinyhttp']]], 4 | ['httpchunkwriter_1',['HttpChunkWriter',['../classtinyhttp_1_1_http_chunk_writer.html',1,'tinyhttp']]], 5 | ['httpheader_2',['HttpHeader',['../classtinyhttp_1_1_http_header.html',1,'tinyhttp']]], 6 | ['httpheaderline_3',['HttpHeaderLine',['../structtinyhttp_1_1_http_header_line.html',1,'tinyhttp']]], 7 | ['httplinereader_4',['HttpLineReader',['../classtinyhttp_1_1_http_line_reader.html',1,'tinyhttp']]], 8 | ['httploggerclass_5',['HttpLoggerClass',['../classtinyhttp_1_1_http_logger_class.html',1,'tinyhttp']]], 9 | ['httpparameters_6',['HttpParameters',['../classtinyhttp_1_1_http_parameters.html',1,'tinyhttp']]], 10 | ['httpreplyheader_7',['HttpReplyHeader',['../classtinyhttp_1_1_http_reply_header.html',1,'tinyhttp']]], 11 | ['httprequest_8',['HttpRequest',['../classtinyhttp_1_1_http_request.html',1,'tinyhttp']]], 12 | ['httprequesthandlerline_9',['HttpRequestHandlerLine',['../classtinyhttp_1_1_http_request_handler_line.html',1,'tinyhttp']]], 13 | ['httprequestheader_10',['HttpRequestHeader',['../classtinyhttp_1_1_http_request_header.html',1,'tinyhttp']]], 14 | ['httprequestrewrite_11',['HttpRequestRewrite',['../classtinyhttp_1_1_http_request_rewrite.html',1,'tinyhttp']]], 15 | ['httpserver_12',['HttpServer',['../classtinyhttp_1_1_http_server.html',1,'tinyhttp']]], 16 | ['httpstreamcopy_13',['HttpStreamCopy',['../classtinyhttp_1_1_http_stream_copy.html',1,'tinyhttp']]], 17 | ['httpstreamedmultioutput_14',['HttpStreamedMultiOutput',['../classtinyhttp_1_1_http_streamed_multi_output.html',1,'tinyhttp']]], 18 | ['httpstreamedoutput_15',['HttpStreamedOutput',['../classtinyhttp_1_1_http_streamed_output.html',1,'tinyhttp']]], 19 | ['httptunnel_16',['HttpTunnel',['../classtinyhttp_1_1_http_tunnel.html',1,'tinyhttp']]] 20 | ]; 21 | -------------------------------------------------------------------------------- /src/Server/HttpLogger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Platform/AltStream.h" 4 | #include 5 | #include 6 | #include 7 | 8 | namespace tinyhttp { 9 | 10 | /** 11 | * @brief Supported log levels 12 | * 13 | */ 14 | enum LogLevel { 15 | Debug, 16 | Info, 17 | Warning, 18 | Error 19 | }; 20 | 21 | const char* HttpLogLevelStr[] = {"Debug","Info","Warning","Error"}; 22 | 23 | /** 24 | * @brief Logger that writes messages dependent on the log level 25 | * 26 | */ 27 | 28 | class HttpLoggerClass { 29 | public: 30 | HttpLoggerClass()= default; 31 | 32 | // activate the logging 33 | virtual void begin(Stream& out, LogLevel level=Error){ 34 | this->log_stream_ptr = &out; 35 | this->log_level = level; 36 | } 37 | 38 | void setLevel(LogLevel l){ 39 | log_level = l; 40 | } 41 | 42 | // checks if the logging is active 43 | virtual bool isLogging(){ 44 | return log_stream_ptr!=nullptr; 45 | } 46 | 47 | /// Print log message 48 | void log(LogLevel current_level, const char *fmt...) { 49 | if (current_level >= log_level && log_stream_ptr!=nullptr&& fmt!=nullptr){ 50 | char log_buffer[200]; 51 | strcpy(log_buffer,"TinyHttp - "); 52 | strcat(log_buffer, HttpLogLevelStr[current_level]); 53 | strcat(log_buffer, ": "); 54 | va_list arg; 55 | va_start(arg, fmt); 56 | vsprintf(log_buffer + 9, fmt, arg); 57 | va_end(arg); 58 | log_stream_ptr->println(log_buffer); 59 | } 60 | } 61 | 62 | 63 | protected: 64 | Stream *log_stream_ptr=&Serial; 65 | LogLevel log_level = Warning; 66 | 67 | }; 68 | 69 | HttpLoggerClass HttpLogger; 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /examples/server/server.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * @file server.ino 3 | * @author SSID (phil.schatzmann@gmail.com) 4 | * @brief We start a Webserver and demonstrate how to define the output by providing strings 5 | * or by defining a lambda function. 6 | * @version 0.1 7 | * @date 2020-11-30 8 | * 9 | * @copyright Copyright (c) 2020 10 | * 11 | */ 12 | 13 | #include "HttpServer.h" 14 | 15 | const char* ssid = "SSID"; 16 | const char* password = "PASSWORD"; 17 | WiFiServer wifi; 18 | HttpServer server(wifi); 19 | Url indexUrl("/index.html"); 20 | 21 | void setup() { 22 | Serial.begin(115200); 23 | // connect to WIFI 24 | HttpLogger.begin(Serial,Info); 25 | 26 | const char*htmlHallo = 27 | "" 28 | "" 29 | "" 30 | "

Arduino Http Server

" 31 | "

Hallo world...

" 32 | "" 33 | ""; 34 | 35 | auto countLambda = [](HttpServer *server, const char* requestPath, HttpRequestHandlerLine *hl) { 36 | char buffer[2048]; 37 | StrView str(buffer, 2048); 38 | str += ""; 39 | str += ""; 40 | str += ""; 41 | str += "

Counting Callback Example

"; 42 | 43 | for (int j=0;j<100;j++){ 44 | str+= "test "; 45 | str += j; 46 | str += "
"; 47 | } 48 | str += ""; 49 | 50 | server->reply("text/html", str.c_str(), 200, SUCCESS); 51 | }; 52 | 53 | server.rewrite("/","/hallo.html"); 54 | server.rewrite("/index.html","/hallo.html"); 55 | 56 | server.on("/hallo.html",T_GET,"text/html",htmlHallo); 57 | server.on("/count",T_GET, countLambda); 58 | server.on("/moved", T_GET, indexUrl); 59 | 60 | server.begin(80, ssid, password); 61 | 62 | } 63 | 64 | void loop(){ 65 | server.doLoop(); 66 | } -------------------------------------------------------------------------------- /docs/html/folderclosed.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/html/folderclosedd.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/Extensions/ExtensionSD.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Server/HttpServer.h" 4 | #include "Utils/MimeResolver.h" 5 | #include 6 | #include 7 | 8 | namespace tinyhttp { 9 | 10 | /** 11 | * @brief Extension which serves the files which are available on the SD card 12 | * We return the full file content - so use this class only for small files! 13 | */ 14 | class ExtensionSD : public Extension { 15 | public: 16 | ExtensionSD(const char* path="/*", int cspin=-1){ 17 | HttpLogger.log(Info,"ExtensionSD %s", path); 18 | this->path = path; 19 | this->sd_cs = cspin; 20 | } 21 | 22 | virtual void open(HttpServer *server) { 23 | HttpLogger.log(Info,"ExtensionSD %s", "open"); 24 | setupSD(); 25 | 26 | // define the file handler 27 | auto lambda = [](HttpServer *server_ptr,const char*requestPath, HttpRequestHandlerLine *hl) { 28 | const char* path = requestPath; 29 | HttpLogger.log(Info,"ExtensionSD::lambda %s", path); 30 | if (SD.exists(path)){ 31 | File file = SD.open(path); 32 | int size = file.size(); 33 | MimeResolver resolver; 34 | const char* mime = resolver.getMime(file.name()); 35 | // void reply(char* contentType, Stream &inputStream, int size, int status=200, char* msg=SUCCESS){ 36 | server_ptr->reply(mime, file, size, 200); 37 | } else { 38 | HttpLogger.log(Error, "ExtensionSD::open - file %s does not exist",path); 39 | } 40 | }; 41 | // register default SD File handler 42 | server->on(path, T_GET, lambda); 43 | } 44 | 45 | protected: 46 | const char* path; 47 | int sd_cs; 48 | bool is_open = false; 49 | 50 | void setupSD() { 51 | if (!is_open) { 52 | if (sd_cs==-1){ 53 | SD.begin(); 54 | } else { 55 | SD.begin(sd_cs); 56 | } 57 | is_open = true; 58 | } 59 | } 60 | 61 | }; 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /docs/html/search/functions_f.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['schedule_0',['schedule',['../classtinyhttp_1_1_ticker.html#a3ca0e8b7836a900167d84a2960e1e9ff',1,'tinyhttp::Ticker']]], 4 | ['set_1',['set',['../classtinyhttp_1_1_str_view.html#aa742d688d70a19548d742a157dcfb9c2',1,'tinyhttp::StrView::set(const char *alt)'],['../classtinyhttp_1_1_str_view.html#a1c0159cfc5b5ef4e18c31c87c5e7d326',1,'tinyhttp::StrView::set(const StrView &alt)'],['../classtinyhttp_1_1_str_view.html#afbebdfba78f3411845c8a039ae0a438e',1,'tinyhttp::StrView::set(char chars[], int maxlen, int len=0, bool isConst=false)']]], 5 | ['setlength_2',['setLength',['../classtinyhttp_1_1_str_view.html#a3a4e7e033711534ecbfb957825665066',1,'tinyhttp::StrView']]], 6 | ['setlengthundo_3',['setLengthUndo',['../classtinyhttp_1_1_str_view.html#a50c9b8b606745426791bafcc5bd1ec4a',1,'tinyhttp::StrView']]], 7 | ['setreplyheader_4',['setreplyheader',['../classtinyhttp_1_1_extension_stream.html#a10ac6ec59e7052ea516eb542ef2539c0',1,'tinyhttp::ExtensionStream::setReplyHeader()'],['../classtinyhttp_1_1_extension_stream_basic.html#aa0ec6e4da06b988dab689e48aa8e0074',1,'tinyhttp::ExtensionStreamBasic::setReplyHeader()']]], 8 | ['startdump_5',['startDump',['../classtinyhttp_1_1_web_copy.html#a19a6776ac968ca86e78ddd2132dc22b6',1,'tinyhttp::WebCopy']]], 9 | ['startswith_6',['startsWith',['../classtinyhttp_1_1_str_view.html#a688849cec0fe82ae86ee22fa370775fe',1,'tinyhttp::StrView']]], 10 | ['stop_7',['stop',['../classtinyhttp_1_1_ticker.html#a8005e24ef8627b1b84286275c0df586f',1,'tinyhttp::Ticker']]], 11 | ['stopall_8',['stopAll',['../classtinyhttp_1_1_ticker.html#a0c90114256432d558c8be07c0e083d1a',1,'tinyhttp::Ticker']]], 12 | ['strview_9',['strview',['../classtinyhttp_1_1_str_view.html#af6f60a3892629d73813b6caec61ebfea',1,'tinyhttp::StrView::StrView(const char *chars)'],['../classtinyhttp_1_1_str_view.html#a7bcbf378431e7386a25d9a2c4d3515bd',1,'tinyhttp::StrView::StrView(char chars[], int maxlen, int len=0)']]], 13 | ['substring_10',['substring',['../classtinyhttp_1_1_str_view.html#a2aeb4676446d4b82ea41fad2401696ab',1,'tinyhttp::StrView::substring(StrView &from, int start, int end)'],['../classtinyhttp_1_1_str_view.html#a18cdb12d615368de77f47a1baa8b3f8d',1,'tinyhttp::StrView::substring(const char *from, int start, int end)']]] 14 | ]; 15 | -------------------------------------------------------------------------------- /src/Platform/AltStream.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef PLATFORM_LINUX 4 | #include 5 | #else 6 | 7 | namespace tinyhttp { 8 | 9 | /** 10 | * @brief We provide the Stream class so that it complies outside of the Arduino Environment. 11 | * 12 | */ 13 | class Stream { 14 | public: 15 | virtual void print(const char* str="") = 0; 16 | virtual void println(const char* str="") = 0; 17 | virtual void flush() = 0; 18 | virtual void write(const char* str, int len) = 0; 19 | virtual void write(uint8_t* str, int len) = 0; 20 | 21 | }; 22 | 23 | 24 | void delay(int n){ 25 | 26 | }; 27 | 28 | /** 29 | * @brief We use the SerialDef class to be able to provide Serail, Serial1 and Serial2 outside of the 30 | * Arduino environment; 31 | * 32 | */ 33 | class SerialDef : public Stream { 34 | public: 35 | virtual void begin(int speed){ 36 | // nothing to be done 37 | } 38 | virtual void print(const char* str){ 39 | std::cout << str; 40 | std::cout.flush(); 41 | } 42 | virtual void println(const char* str=""){ 43 | std::cout << str << "\n"; 44 | std::cout.flush(); 45 | } 46 | virtual void print(int str){ 47 | std::cout << str; 48 | std::cout.flush(); 49 | } 50 | virtual void println(int str){ 51 | std::cout << str << "\n"; 52 | std::cout.flush(); 53 | } 54 | virtual void flush() { 55 | std::cout.flush(); 56 | } 57 | virtual void write(const char* str, int len) { 58 | std::cout.write(str, len); 59 | } 60 | virtual void write(uint8_t* str, int len) { 61 | std::cout.write((const char*)str, len); 62 | } 63 | 64 | }; 65 | 66 | SerialDef Serial; 67 | SerialDef Serial1; 68 | SerialDef Serial2; 69 | 70 | const int WL_CONNECTED = 1; 71 | 72 | /** 73 | * @brief We provide the WiFi class, so that the demo applcations can be compiled outside of the 74 | * Arduino Environment. 75 | * 76 | */ 77 | class WifiMock { 78 | public: 79 | virtual void begin(const char*name, const char* pwd){ 80 | // nothing to be done 81 | } 82 | // we assume the network to be available on a desktop or host machine 83 | int status() { 84 | return WL_CONNECTED; 85 | } 86 | 87 | }; 88 | 89 | WifiMock WiFi; 90 | 91 | 92 | } 93 | 94 | #endif // PLATFORM_LINUX 95 | -------------------------------------------------------------------------------- /examples/webservice/webservice-ext/webservice-ext.ino: -------------------------------------------------------------------------------- 1 | /** 2 | * @file webservice 3 | * @author Phil Schatzmann 4 | * @brief A simple webservice that supports T_GET and T_POST using ArduinoJson 5 | * @version 0.1 6 | * @date 2022-10-05 7 | * 8 | * @copyright Copyright (c) 2022 9 | * 10 | */ 11 | #include "HttpServer.h" 12 | #include "ArduinoJson.h" 13 | 14 | // json parameters 15 | float volumeControl = 1.0; 16 | int16_t clipThreashold = 4990; 17 | float fuzzEffectValue = 6.5; 18 | int16_t distortionControl = 4990; 19 | int16_t tremoloDuration = 200; 20 | float tremoloDepth = 0.5; 21 | 22 | // Server 23 | WiFiServer wifi; 24 | HttpServer server(wifi); 25 | const char *ssid = "SSID"; 26 | const char *password = "password"; 27 | 28 | void parameters2Json(Stream &out) { 29 | DynamicJsonDocument doc(1024); 30 | doc["volumeControl"] = volumeControl; 31 | doc["clipThreashold"] = clipThreashold; 32 | doc["fuzzEffectValue"] = fuzzEffectValue; 33 | doc["distortionControl"] = distortionControl; 34 | doc["tremoloDuration"] = tremoloDuration; 35 | doc["tremoloDepth"] = tremoloDepth; 36 | serializeJson(doc, out); 37 | } 38 | 39 | void json2Parameters(Stream &in) { 40 | DynamicJsonDocument doc(1024); 41 | deserializeJson(doc, in); 42 | volumeControl = doc["volumeControl"]; 43 | clipThreashold = doc["clipThreashold"]; 44 | fuzzEffectValue = doc["fuzzEffectValue"]; 45 | distortionControl = doc["distortionControl"]; 46 | tremoloDuration = doc["tremoloDuration"]; 47 | tremoloDepth = doc["tremoloDepth"]; 48 | } 49 | 50 | // Arduino Setup 51 | void setup(void) { 52 | Serial.begin(115200); 53 | HttpLogger.begin(Serial, Warning); 54 | 55 | auto getJson = [](HttpServer *server, const char*requestPath, HttpRequestHandlerLine *hl) { 56 | // reply using callback 57 | server->reply("text/json", parameters2Json, 200); 58 | }; 59 | 60 | auto postJson = [](HttpServer *server, const char*requestPath, HttpRequestHandlerLine *hl) { 61 | // read content from client 62 | json2Parameters(server->client()); 63 | server->replyOK(); 64 | }; 65 | 66 | server.rewrite("/","/service"); 67 | server.on("/service",T_GET, getJson); 68 | server.on("/service",T_POST, postJson); 69 | server.begin(80, ssid, password); 70 | 71 | } 72 | 73 | // Arduino loop - copy data 74 | void loop() { 75 | server.copy(); 76 | } -------------------------------------------------------------------------------- /docs/html/search/all_9.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['lastindexof_0',['lastIndexOf',['../classtinyhttp_1_1_str_view.html#adc4a4a3e39d86eb7888053ae1c1882a2',1,'tinyhttp::StrView']]], 4 | ['length_1',['length',['../classtinyhttp_1_1_str_view.html#a0ce3829ef2304731db3c777f60263ee4',1,'tinyhttp::StrView']]], 5 | ['list_2',['list',['../classtinyhttp_1_1_list.html',1,'tinyhttp::List< T >'],['../classtinyhttp_1_1_list.html#a3f46b947d78875298b1988a41370ffcd',1,'tinyhttp::List::List(const T(&a)[N])'],['../classtinyhttp_1_1_list.html#a5f82365d7e691f13d91df58103937712',1,'tinyhttp::List::List(const List &ref)=default'],['../classtinyhttp_1_1_list.html#a847d46a4463e62f662e7945adcaf9a1c',1,'tinyhttp::List::List()']]], 6 | ['list_3c_20tinyhttp_3a_3aextension_20_2a_20_3e_3',['List< tinyhttp::Extension * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 7 | ['list_3c_20tinyhttp_3a_3ahttpheaderline_20_2a_20_3e_4',['List< tinyhttp::HttpHeaderLine * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 8 | ['list_3c_20tinyhttp_3a_3ahttprequesthandlerline_20_2a_20_3e_5',['List< tinyhttp::HttpRequestHandlerLine * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 9 | ['list_3c_20tinyhttp_3a_3ahttprequestrewrite_20_2a_20_3e_6',['List< tinyhttp::HttpRequestRewrite * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 10 | ['list_3c_20tinyhttp_3a_3ahttpstreamcopy_20_2a_20_3e_7',['List< tinyhttp::HttpStreamCopy * >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 11 | ['list_3c_20tinyhttp_3a_3awificlient_20_3e_8',['List< tinyhttp::WiFiClient >',['../classtinyhttp_1_1_list.html',1,'tinyhttp']]], 12 | ['localhost_9',['localHost',['../classtinyhttp_1_1_http_server.html#a7b66f3ae2446ba90a31b4bedc99310ec',1,'tinyhttp::HttpServer']]], 13 | ['localip_10',['localIP',['../classtinyhttp_1_1_http_server.html#a43b1773580c00cf847f78753177234bb',1,'tinyhttp::HttpServer']]], 14 | ['log_11',['log',['../classtinyhttp_1_1_http_logger_class.html#a8bd88841bae9816af7240a3706e8512e',1,'tinyhttp::HttpLoggerClass']]], 15 | ['logging_12',['Logging',['../index.html#autotoc_md2',1,'']]], 16 | ['logging_20with_20http_13',['Example - Logging with Http',['../index.html#autotoc_md4',1,'']]], 17 | ['login_14',['login',['../classtinyhttp_1_1_http_server.html#a50bd62d94267038636140056f7f702e6',1,'tinyhttp::HttpServer']]], 18 | ['ltrim_15',['ltrim',['../classtinyhttp_1_1_str_view.html#a4e73a014165e6afaacc1db2f37ace81d',1,'tinyhttp::StrView']]] 19 | ]; 20 | -------------------------------------------------------------------------------- /docs/html/search/all_7.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['haskey_0',['hasKey',['../classtinyhttp_1_1_http_parameters.html#a8fe27108ffbd6d50a9d4cdfc57e4077e',1,'tinyhttp::HttpParameters']]], 4 | ['http_1',['Example - Logging with Http',['../index.html#autotoc_md4',1,'']]], 5 | ['httpchunkreader_2',['httpchunkreader',['../classtinyhttp_1_1_http_chunk_reader.html',1,'tinyhttp::HttpChunkReader'],['../classtinyhttp_1_1_http_chunk_reader.html#acbfc3feca63efea9f2dd4e5832be816d',1,'tinyhttp::HttpChunkReader::HttpChunkReader(HttpReplyHeader &header)'],['../classtinyhttp_1_1_http_chunk_reader.html#a9568f9de19f81a47a933819af365c33d',1,'tinyhttp::HttpChunkReader::HttpChunkReader()']]], 6 | ['httpchunkwriter_3',['HttpChunkWriter',['../classtinyhttp_1_1_http_chunk_writer.html',1,'tinyhttp']]], 7 | ['httpheader_4',['HttpHeader',['../classtinyhttp_1_1_http_header.html',1,'tinyhttp']]], 8 | ['httpheaderline_5',['HttpHeaderLine',['../structtinyhttp_1_1_http_header_line.html',1,'tinyhttp']]], 9 | ['httplinereader_6',['HttpLineReader',['../classtinyhttp_1_1_http_line_reader.html',1,'tinyhttp']]], 10 | ['httploggerclass_7',['HttpLoggerClass',['../classtinyhttp_1_1_http_logger_class.html',1,'tinyhttp']]], 11 | ['httpparameters_8',['httpparameters',['../classtinyhttp_1_1_http_parameters.html',1,'tinyhttp::HttpParameters'],['../classtinyhttp_1_1_http_parameters.html#aad3e97e6799540df8c5c22254d830116',1,'tinyhttp::HttpParameters::HttpParameters()']]], 12 | ['httpreplyheader_9',['HttpReplyHeader',['../classtinyhttp_1_1_http_reply_header.html',1,'tinyhttp']]], 13 | ['httprequest_10',['HttpRequest',['../classtinyhttp_1_1_http_request.html',1,'tinyhttp']]], 14 | ['httprequesthandlerline_11',['HttpRequestHandlerLine',['../classtinyhttp_1_1_http_request_handler_line.html',1,'tinyhttp']]], 15 | ['httprequestheader_12',['HttpRequestHeader',['../classtinyhttp_1_1_http_request_header.html',1,'tinyhttp']]], 16 | ['httprequestrewrite_13',['HttpRequestRewrite',['../classtinyhttp_1_1_http_request_rewrite.html',1,'tinyhttp']]], 17 | ['httpserver_14',['HttpServer',['../classtinyhttp_1_1_http_server.html',1,'tinyhttp']]], 18 | ['httpstreamcopy_15',['HttpStreamCopy',['../classtinyhttp_1_1_http_stream_copy.html',1,'tinyhttp']]], 19 | ['httpstreamedmultioutput_16',['HttpStreamedMultiOutput',['../classtinyhttp_1_1_http_streamed_multi_output.html',1,'tinyhttp']]], 20 | ['httpstreamedoutput_17',['HttpStreamedOutput',['../classtinyhttp_1_1_http_streamed_output.html',1,'tinyhttp']]], 21 | ['httptunnel_18',['HttpTunnel',['../classtinyhttp_1_1_http_tunnel.html',1,'tinyhttp']]] 22 | ]; 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Issue-report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Report only a bugs here! 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | * Before reporting a new bug please check and search the [list of existing issues](https://github.com/pschatzmann/arduino-audiokit/issues?q=) 8 | * Please check [the Readme](https://github.com/pschatzmann/arduino-audiokit) and [Wiki](https://github.com/pschatzmann/arduino-audiokit/wiki) 9 | * Don't forget to check [the discusions](https://github.com/pschatzmann/arduino-audiokit/discussions) 10 | * If still experiencing the issue, please provide as many details as possible below about your hardware, computer setup and code. 11 | - type: textarea 12 | id: Description 13 | attributes: 14 | label: Problem Description 15 | description: Please describe your problem here and expected behaviour 16 | placeholder: ex. Can't connect/weird behaviour/wrong function/missing parameter.. 17 | validations: 18 | required: true 19 | - type: textarea 20 | id: Board 21 | attributes: 22 | label: Device Description 23 | description: What development board are you using 24 | placeholder: e.g. ai_thinker (ES8388) rev 2957 25 | validations: 26 | required: true 27 | - type: textarea 28 | id: sketch 29 | attributes: 30 | label: Sketch 31 | description: Please provide full minimal sketch/code which can be run to reproduce your issue 32 | placeholder: ex. Related part of the code to replicate the issue 33 | render: cpp 34 | validations: 35 | required: true 36 | - type: textarea 37 | id: other-remarks 38 | attributes: 39 | label: Other Steps to Reproduce 40 | description: Is there any other information you can think of which will help us reproduce this problem? Any additional info can be added as well. 41 | placeholder: ex. I also tried on other OS, HW...it works correctly on that setup. 42 | 43 | - type: input 44 | id: esp32-version 45 | attributes: 46 | label: Provide your Version of the EP32 Arduino Core 47 | description: This information can be found in the Boards Manager 48 | placeholder: e.g. 2.0.13 49 | 50 | - type: checkboxes 51 | id: confirmation 52 | attributes: 53 | label: I have checked existing issues, discussions and online documentation 54 | description: You agree to check all the resources above before opening a new issue. 55 | options: 56 | - label: I confirm I have checked existing issues, discussions and online documentation 57 | required: true 58 | -------------------------------------------------------------------------------- /docs/html/search/all_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['end_0',['end',['../classtinyhttp_1_1_http_server.html#ad7925a878b142d60e709f08b808851e7',1,'tinyhttp::HttpServer']]], 4 | ['endclient_1',['endClient',['../classtinyhttp_1_1_http_server.html#a5d63c8f7170d736f3623f6d9c99cc5aa',1,'tinyhttp::HttpServer']]], 5 | ['endswith_2',['endsWith',['../classtinyhttp_1_1_str_view.html#a1bf69de9877617a6a1e26c468826164b',1,'tinyhttp::StrView']]], 6 | ['endswithignorecase_3',['endsWithIgnoreCase',['../classtinyhttp_1_1_str_view.html#a162bd19032f76f19c6a5209630afd48b',1,'tinyhttp::StrView']]], 7 | ['equals_4',['equals',['../classtinyhttp_1_1_str_view.html#a60a91f6a21e5d374df56ae00de9d7f0a',1,'tinyhttp::StrView']]], 8 | ['equalsignorecase_5',['equalsIgnoreCase',['../classtinyhttp_1_1_str_view.html#a66aaf132965b8b599c1c20b1503229f0',1,'tinyhttp::StrView']]], 9 | ['example_20logging_20with_20http_6',['Example - Logging with Http',['../index.html#autotoc_md4',1,'']]], 10 | ['example_3a_20basic_20server_7',['Example: Basic Server',['../index.html#autotoc_md1',1,'']]], 11 | ['extension_8',['Extension',['../classtinyhttp_1_1_extension.html',1,'tinyhttp']]], 12 | ['extensionesptask_9',['ExtensionESPTask',['../classtinyhttp_1_1_extension_e_s_p_task.html',1,'tinyhttp']]], 13 | ['extensionloggingstream_10',['ExtensionLoggingStream',['../classtinyhttp_1_1_extension_logging_stream.html',1,'tinyhttp']]], 14 | ['extensionmusicfilestream_11',['ExtensionMusicFileStream',['../classtinyhttp_1_1_extension_music_file_stream.html',1,'tinyhttp']]], 15 | ['extensions_12',['Extensions',['../index.html#autotoc_md3',1,'']]], 16 | ['extensionsd_13',['ExtensionSD',['../classtinyhttp_1_1_extension_s_d.html',1,'tinyhttp']]], 17 | ['extensionsdstreamed_14',['ExtensionSDStreamed',['../classtinyhttp_1_1_extension_s_d_streamed.html',1,'tinyhttp']]], 18 | ['extensionstream_15',['extensionstream',['../classtinyhttp_1_1_extension_stream.html',1,'tinyhttp::ExtensionStream'],['../classtinyhttp_1_1_extension_stream.html#a50878efa957c51e0cccb1835e6576066',1,'tinyhttp::ExtensionStream::ExtensionStream(const char *url, TinyMethodID action, const char *mime, const char *startHtml=nullptr, const char *endHtml=nullptr, int bufferSize=256, int historySize=1024)'],['../classtinyhttp_1_1_extension_stream.html#ab031febbdb2bf855e8eb8ed5feea4e27',1,'tinyhttp::ExtensionStream::ExtensionStream(const char *url, const char *mime, Stream &source)']]], 19 | ['extensionstreambasic_16',['extensionstreambasic',['../classtinyhttp_1_1_extension_stream_basic.html',1,'tinyhttp::ExtensionStreamBasic'],['../classtinyhttp_1_1_extension_stream_basic.html#aa233b1e82defe51a43b3b4b8027a77f6',1,'tinyhttp::ExtensionStreamBasic::ExtensionStreamBasic()']]] 20 | ]; 21 | -------------------------------------------------------------------------------- /examples/serverSD/serverSD.ino: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * @file serverSD.ino 4 | * @author SSID (phil.schatzmann@gmail.com) 5 | * @brief We start a Webserver which serves the pages from a SD card. 6 | * @version 0.1 7 | * @date 2020-11-30 8 | * 9 | * @copyright Copyright (c) 2020 10 | * 11 | */ 12 | 13 | #include "HttpServer.h" 14 | #include "HttpExtensions.h" 15 | 16 | // I was using the AudioKit to test: It has quite some strange SD pin setup 17 | #define PIN_AUDIO_KIT_SD_CARD_CS 13 18 | #define PIN_AUDIO_KIT_SD_CARD_MISO 2 19 | #define PIN_AUDIO_KIT_SD_CARD_MOSI 15 20 | #define PIN_AUDIO_KIT_SD_CARD_CLK 14 21 | 22 | 23 | const char* ssid = "SSID"; 24 | const char* password = "PASSWORD"; 25 | WiFiServer wifi; 26 | HttpServer server(wifi); 27 | ExtensionSD sd("/*", PIN_AUDIO_KIT_SD_CARD_CS); // or use ExtensionSDStreamed 28 | 29 | void setup() { 30 | Serial.begin(115200); 31 | HttpLogger.begin(Serial, Info); 32 | 33 | // If you use custom pins for the CD drive: Comment out if you use the standard pins 34 | SPI.begin(PIN_AUDIO_KIT_SD_CARD_CLK, PIN_AUDIO_KIT_SD_CARD_MISO, PIN_AUDIO_KIT_SD_CARD_MOSI, PIN_AUDIO_KIT_SD_CARD_CS); 35 | 36 | // start server 37 | server.rewrite("/","/index.html"); 38 | server.addExtension(sd); 39 | server.begin(80, ssid, password); 40 | HttpLogger.log(Info,"server was started..."); 41 | 42 | // create test files 43 | setupTestFiles(); 44 | } 45 | 46 | void setupTestFiles(){ 47 | HttpLogger.log(Info,"setupTestFiles"); 48 | const char* index = "

SD Example

test1
test2
test3"; 49 | const char* test1 = "

Test1

Lorem ipsum dolor sit amet, consectetur adipiscing elit. "; 50 | const char* test2 = "

Test2

Lorem ipsum dolor sit amet, consectetur adipiscing elit. "; 51 | const char* test3 = "

Test3

Lorem ipsum dolor sit amet, consectetur adipiscing elit. "; 52 | setupTestFile("/index.html",index); 53 | setupTestFile("/test1.html",test1); 54 | setupTestFile("/test2.html",test2); 55 | setupTestFile("/test3.html",test3); 56 | 57 | } 58 | 59 | void setupTestFile(const char* fileName, const char* content){ 60 | HttpLogger.log(Info,"setupTestFile", fileName); 61 | File file = SD.open(fileName, FILE_WRITE); 62 | file.seek(0); 63 | file.write((uint8_t*)content, strlen(content)); 64 | file.close(); 65 | } 66 | 67 | void loop(){ 68 | server.doLoop(); 69 | } -------------------------------------------------------------------------------- /src/Server/HttpLineReader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Server/HttpLogger.h" 4 | 5 | namespace tinyhttp { 6 | 7 | /** 8 | * @brief We read a single line. A terminating 0 is added to the string to make it 9 | * compliant for c string functions. 10 | * 11 | */ 12 | 13 | class HttpLineReader { 14 | public: 15 | HttpLineReader(){} 16 | // reads up the the next CR LF - but never more then the indicated len. returns the number of characters read including crlf 17 | virtual int readlnInternal(Stream &client, uint8_t* str, int len, bool incl_nl=true){ 18 | int result = 0; 19 | HttpLogger.log(Debug, "HttpLineReader","readlnInternal"); 20 | // wait for first character 21 | for (int w=0;w<20 && client.available()==0; w++){ 22 | delay(100); 23 | } 24 | // if we do not have any data we stop 25 | if (client.available()==0) { 26 | HttpLogger.log(Warning, "HttpLineReader","readlnInternal->no Data"); 27 | str[0]=0; 28 | return 0; 29 | } 30 | 31 | // process characters until we find a new line 32 | bool is_buffer_owerflow = false; 33 | int j=0; 34 | while (true){ 35 | int c = client.read(); 36 | if (c==-1){ 37 | break; 38 | } 39 | 40 | if (j=1){ 52 | if (str[j-1]=='\r'){ 53 | // remove cr 54 | str[j-1]=0; 55 | break;; 56 | } else { 57 | // remove nl 58 | str[j]=0; 59 | break; 60 | } 61 | } 62 | } 63 | } 64 | if (!is_buffer_owerflow){ 65 | str[j] = c; 66 | } 67 | j++; 68 | } 69 | str[result]=0; 70 | str[result-1]=0; 71 | if (is_buffer_owerflow){ 72 | HttpLogger.log(Error, "Line cut off:", (const char*) str); 73 | } 74 | return result; 75 | } 76 | }; 77 | 78 | } 79 | --------------------------------------------------------------------------------