aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/http_static/static_server.c
AgeCommit message (Collapse)AuthorFilesLines
2022-12-09http_static: clean up http redirect generationDave Barach1-1/+56
Don't redirect to "favicon.ico/index.html" if you can't find "favicon.ico". If asked to serve up a nonexistent path, see if the path ends with a known suffix: ".jpg, .html, .ico" etc. If it does, flunk the request on the spot: "Error 404 Not Found." Do not issue a redirect. This change will not break the obvious corner case: if the browser asks for "its_a_dir.mp3/index.html" - and the file exists - the server will produce it. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I91aad90be05b98ba2b40e240d13d71816aed4526
2022-12-08http_static: derive mime type from file extensionsDave Barach1-1/+46
Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I0f087477e257f5119d7d6182d19f8796773a1f19
2022-12-07http_static: misc bug fixesDave Barach1-0/+2
The request vector generated by hss_ts_rx_callback() must be NULL terminated. The hss_main_t use_ptr_thresh member must be a u64 since unformat_memory_size() expects it. Otherwise, the adjacent u8 enable_url_handlers may have an accident. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I2cc08e3cbd31b225fb03799283c055515add13bf
2022-12-06http_static: fix http(s) redirectsDave Barach1-3/+2
Add an http redirect template to generate correct-looking "301 Moved Permanently" replies. Supply a default value of 1<<31 for the use_ptr_thresh config parameter. Expose hss_session_get() so friend plugins which register GET / POST handlers with the http_static server can add data to the session fifos. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ie1452eaf61c6f67311fbab092bc1fe03050bf94f
2022-08-12http_static: validate session before sendingFlorin Coras1-0/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I18b9d0d67f5fe4c1714427259df29026153d8dd1
2022-04-04vppinfra: make _vec_len() read-onlyDamjan Marion1-1/+1
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-02-23http hsa: support multiple listeners for http tpsFlorin Coras1-0/+1
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie89326ed4e599231fc20de67c5dadbb428568bec
2022-02-13hsa: add http throughput test server appFlorin Coras1-1/+1
Can be used for throughput testing over http. For instance, start server: http tps #implicitly listens on port 80 Then, to test throughput with curl: curl <server_ip>/test_file_10g curl <server_ip>/test_file_123m Similarly, for https: http tps uri tls://<server_ip>/443 curl -k <server_ip>/test_file_1g Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I30ab7f0d94a7357b3f04546e4a3d3c410a733908
2022-02-08http_static: cleanup file handler and cacheFlorin Coras1-456/+138
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I7aff3a02315f9f92039dd2e3af1cbd8312aec662
2022-02-06http_static: fix coverity warningFlorin Coras1-2/+4
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I6d5527c49e9085f35be988549c2f1460be7fd4f0
2022-02-05http_static: handle empty requestsFlorin Coras1-3/+12
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic002444c51b1ecbbf18a49863cf01888d28c4632
2022-02-02prom: basic builtin prometheus stats exporterFlorin Coras1-0/+4
This is a vpp builtin alternative, not a replacement, for the existing vpp_prometheus_exporter. The plugin works by registering with http_static as a url handler for stats.prom and handles requests by scraping the stats segment in the main thread. It will therefore consume vpp process cpu cycles. By default the plugin is disabled. To enable, first start the http static server an then use "prom enable" cli. Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: If6888e965d1b2361f6a5546586068213d37079d1
2022-02-02http_static: add support for async tx from handlersFlorin Coras1-21/+55
URL handlers can send data asynchronously if needed. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I89eae690cb26543479c7659b5dc46604cbb22eba
2022-01-30http_static: incorporate builtinurl pluginFlorin Coras1-31/+59
External handlers can still be registered via hss_register_url_handler but url handlers must be enabled when server is created. builtinurl plugin to be removed in a future patch Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I94e103d908b9e118c7927b997a21ce3f67809889
2022-01-27http_static: code cleanupFlorin Coras1-252/+118
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic8838c8ef558d671740094a98b5a627a18c8c808
2022-01-26http_static: refactor to use http transportFlorin Coras1-730/+237
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I66396a1879eb3c87ef64783eab82a22896413cd0
2021-12-30svm: merge want deq and leq threshold notificationsFlorin Coras1-8/+5
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I2775af35386a4e52ba82991c68bce6c56f13410f
2021-12-29http_static: Fix timeout on large filesMichal Kalderon1-3/+19
When trying to read files that are larger than the fifo a timeout was reached on client side leading to an abort of the request and a retry (sending another GET command). The svm fifo notification request was set to notify when the fifo is no longer full, this lead to an inefficient loop of sending small amounts of data each time with a large overhead of context switch and waiting for the next notification, eventually leading to a timeout. Modifying the trigger on the svm-fifo to be notified on a preset threshold value enabled sending larger amounts of data between context switches and sending large files more efficiently. This solved the timeout issue. In addition, cap the max write from application to 4MB to avoid running into a case of trying to allocate chunks that are too large. Reproduce: Server: http static server www-root /var/www/data uri tcp://0.0.0.0/80 cache-size 5m fifo-size 300 Client: wget http://11.0.0.2/file_of_size_32M Type: fix Change-Id: Idfceedffd935da9486cde820e9dca5dad69d9ca5 Signed-off-by: Yuval Caduri <cyuval@marvell.com> Signed-off-by: Michal Kalderon <mkalderon@marvell.com>
2021-05-07session: connects seg manager is always firstFlorin Coras1-2/+2
By convention, connects segment manager will be first. Therefore it will be the one with the first segment wherein lies the app's message queue. Saves us the trouble of allocating it on first connect, if app started by listening, and we no longer need to track if it's assignable to a listener or if it can be removed. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iba9a8ffaab618eeb41ec2144dcfee62d006dc7a2
2021-04-22vcl session: refactor passing of crypto contextFlorin Coras1-2/+18
Pass tls/quic crypto context using extended config instead of bloating conect/listen messages. Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I0bc637ae310e6c31ef1e16847501dcb81453ee94
2021-01-07vcl session: switch to generic cert key apisFlorin Coras1-16/+21
Remove the deprecated tls apis. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia1e12bd813671146f0aca22e83d04c23ac13e595
2020-12-14misc: move to new pool_foreach macrosDamjan Marion1-3/+3
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-19misc: don't export symbols from pluginsDamjan Marion1-1/+1
Type: improvement Change-Id: I2a176fe2871d2e54b010bffc4f1f7a3616f0c455 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-07-28http_static: fix session cleanupFlorin Coras1-41/+30
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ibb380eecca76ed9c00ed14c167dfcf576f943db0
2020-06-16misc: fix sonarclound warningsDave Barach1-1/+1
Type: fix Ticket: VPP-1888 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I9c2fb926a5e010658088a74051c8c3462ff61734
2020-05-06docs: clean up make docs jobPaul Vinciguerra1-3/+5
Type: docs Change-Id: I9b5e5137eb4c1e89f6e8d7a278cd11a0fd496471 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-04-03session: improve error reportingFlorin Coras1-1/+2
Type: improvement Change-Id: I9dd850a1ce85b0adb5136233f176117e0ee38817 Signed-off-by: Florin Coras <fcoras@cisco.com>
2020-03-12vppinfra: refactor clib_timebase_tDave Barach1-1/+2
Add a clib_time_t * argument to clib_timebase_init(...), to encourage client code to share the vlib_main_t's clib_time_t object. Display the current day / date in GMT via the "show time" debug CLI. Fix the test framework so it processes the new "show time" output format. Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I5e52d57eb164b7cdb6355362d520df6928491711
2020-02-05vppinfra: numa vector placement supportDave Barach1-2/+4
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I7e7d95a089dd849c1f01ecea84529d8dbf239f21
2019-10-17http_static: pass http request type to builtin handlersDave Barach1-2/+2
Makes it easy to tell GETs from POSTs, etc., in case one wants to register the same handler for multiple request types. Return interface stats as a json array, makes .js code a lot simpler. Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iadae7b909cf3e8ea179fe93620737fdf68f888ac
2019-10-17http_static: add "http static cache clear" CLIDave Barach1-0/+75
Useful to force content reloads Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ieecb018bec61a1624574660842d7d92cd84520f9
2019-10-09hsa: use crypto_engine_type_t for TLSNathan Skrzypczak1-1/+1
Type: refactor This patch does the following conversions TLS_ENGINE_X -> CRYPTO_ENGINE_X tls_engine_type_t -> crypto_engine_t It does not change numbering of engines Change-Id: I872dfaec3a6713bf4229c84d1ffd98b8b2419995 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-09-16http_static: add dynamic GET / POST method hooksDave Barach1-175/+137
Add .json output to format_vnet_sw_interface_cntrs(...) Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ied036ebfaaafbf1dfc2a4e396c00f09f40659400
2019-08-12http_static: fix session expiration timer bugsDave Barach1-33/+52
Type: fix Fixes: 21231 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iefdd961ba1dcfd0a8d82e5dc1205b3cd4547943d
2019-08-12http_static: debug spew control, session expiration timersDave Barach1-18/+42
Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I015390b703ef502b8b41efa08bff45e65b5eed83
2019-08-10http_static: tls supportDave Barach1-100/+356
Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I45745e568cd943293d0015a61f67ec799b6804d8
2019-06-12static_http: Typo in short_help.Paul Vinciguerra1-1/+1
Type: fix. Change-Id: I48587c5eba6de6de820d348177b6733d0b048013 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-04-30svm: more fifo refactor/cleanupFlorin Coras1-1/+1
Change-Id: Ie76c69641c8598164d0d00fd498018037258fd86 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-25Clean up redirectsDave Barach1-21/+50
Both firefox and chrome seem happy to browse a hugo-generated site Change-Id: Id216ad9c781643df42ac4fbce598eb2afa600f4d Signed-off-by: Dave Barach <dave@barachs.net>
2019-04-16Static http serverDave Barach1-0/+1392
Good enough to serve the vpp sphinx and doxygen docs. Knows about html, css, and javascript files. Change-Id: Ib18c19f07f35f91ba935ea26ed7be406dacf2205 Signed-off-by: Dave Barach <dave@barachs.net>