ParsedCookie.h 809 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Optional.h>
  8. #include <AK/String.h>
  9. #include <LibCore/DateTime.h>
  10. #include <LibIPC/Forward.h>
  11. namespace Web::Cookie {
  12. struct ParsedCookie {
  13. String name;
  14. String value;
  15. Optional<Core::DateTime> expiry_time_from_expires_attribute {};
  16. Optional<Core::DateTime> expiry_time_from_max_age_attribute {};
  17. Optional<String> domain {};
  18. Optional<String> path {};
  19. bool secure_attribute_present { false };
  20. bool http_only_attribute_present { false };
  21. };
  22. Optional<ParsedCookie> parse_cookie(const String& cookie_string);
  23. }
  24. namespace IPC {
  25. bool encode(IPC::Encoder&, const Web::Cookie::ParsedCookie&);
  26. bool decode(IPC::Decoder&, Web::Cookie::ParsedCookie&);
  27. }