File tree Expand file tree Collapse file tree
include/boost/http_proto/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -207,6 +207,8 @@ enum class cross_domain_policy_type
207207/* * Groups the hsts constants here. */
208208namespace hsts {
209209 inline static constexpr bool preload = true ;
210+ inline static constexpr bool no_preload = false ;
211+ inline static constexpr bool no_subdomains = false ;
210212 inline static constexpr bool include_subdomains = true ;
211213 inline static constexpr size_t default_age = 31536000 ;
212214}
@@ -329,7 +331,15 @@ option_pair x_content_type_options();
329331
330332option_pair content_security_policy (const helmet::csp_policy& sp);
331333
332- option_pair strict_transport_security (const std::size_t age, const bool include_domains = true , const bool preload = false );
334+ /* * Return HSTS configuration for the host.
335+ @param include_subdomains either include_domains or no_subdomains
336+ @param preload either preload or no_preload
337+ @note use the hsts namespace to set those function values.
338+ @return the option_pair to pass to the helmet.
339+ */
340+ option_pair strict_transport_security (std::size_t age,
341+ bool include_subdomains = hsts::include_subdomains,
342+ bool preload = hsts::no_preload);
333343
334344option_pair cross_origin_opener_policy (const coop_policy_type& policy = coop_policy_type::same_origin);
335345
Original file line number Diff line number Diff line change @@ -373,7 +373,7 @@ option_pair cross_origin_embedder_policy(const coep_policy_type& policy)
373373 return {" Cross-Origin-Embedder-Policy" , {value}};
374374}
375375
376- option_pair strict_transport_security (const std::size_t age, const bool include_domains, const bool preload)
376+ option_pair strict_transport_security (std::size_t age, bool include_domains, bool preload)
377377{
378378 std::string value = " max-age=" + std::to_string (age);
379379
Original file line number Diff line number Diff line change @@ -252,9 +252,9 @@ struct helmet_test
252252 helmet_options opt;
253253 helmet::csp_policy csp;
254254
255- csp.append (" default-src" , csp_type::self);
256- csp. append (" script-src" , csp_type::self);
257- csp. append (" style-src" , csp_type::self);
255+ csp.allow (" default-src" , csp_type::self)
256+ . allow (" script-src" , csp_type::self)
257+ . allow (" style-src" , csp_type::self);
258258
259259 opt.set (content_security_policy (csp));
260260
You can’t perform that action at this time.
0 commit comments