http.hpp 772 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Copyright (c) 2020-2023 Paul-Louis Ageneau
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  7. */
  8. #ifndef RTC_IMPL_HTTP_H
  9. #define RTC_IMPL_HTTP_H
  10. #include "common.hpp"
  11. #include <list>
  12. #include <map>
  13. namespace rtc::impl {
  14. // Check the buffer contains the beginning of an HTTP request
  15. bool isHttpRequest(const byte *buffer, size_t size);
  16. // Parse an http message into lines
  17. size_t parseHttpLines(const byte *buffer, size_t size, std::list<string> &lines);
  18. // Parse headers of a http message
  19. std::multimap<string, string> parseHttpHeaders(const std::list<string> &lines);
  20. } // namespace rtc::impl
  21. #endif