ParsedCookie.h 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2021-2023, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/DeprecatedString.h>
  8. #include <AK/Optional.h>
  9. #include <AK/Time.h>
  10. #include <LibIPC/Forward.h>
  11. #include <LibWeb/Cookie/Cookie.h>
  12. namespace Web::Cookie {
  13. struct ParsedCookie {
  14. DeprecatedString name;
  15. DeprecatedString value;
  16. SameSite same_site_attribute { SameSite::Default };
  17. Optional<Time> expiry_time_from_expires_attribute {};
  18. Optional<Time> expiry_time_from_max_age_attribute {};
  19. Optional<DeprecatedString> domain {};
  20. Optional<DeprecatedString> path {};
  21. bool secure_attribute_present { false };
  22. bool http_only_attribute_present { false };
  23. };
  24. Optional<ParsedCookie> parse_cookie(DeprecatedString const& cookie_string);
  25. }
  26. namespace IPC {
  27. template<>
  28. ErrorOr<void> encode(Encoder&, Web::Cookie::ParsedCookie const&);
  29. template<>
  30. ErrorOr<Web::Cookie::ParsedCookie> decode(Decoder&);
  31. }