You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*-
  2. * Copyright 2019 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef RSPAMD_HTTP_UTIL_H
  17. #define RSPAMD_HTTP_UTIL_H
  18. #include "config.h"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /**
  23. * Parse HTTP date header and return it as time_t
  24. * @param header HTTP date header
  25. * @param len length of header
  26. * @return time_t or (time_t)-1 in case of error
  27. */
  28. time_t rspamd_http_parse_date(const char *header, gsize len);
  29. /**
  30. * Prints HTTP date from `time` to `buf` using standard HTTP date format
  31. * @param buf date buffer
  32. * @param len length of buffer
  33. * @param time time in unix seconds
  34. * @return number of bytes written
  35. */
  36. glong rspamd_http_date_format(char *buf, gsize len, time_t time);
  37. #ifdef __cplusplus
  38. }
  39. #endif
  40. #endif