THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
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.

58 lines
2.0KB

  1. #ifndef URL_MATCH_H
  2. #define URL_MATCH_H
  3. #include "string-list.h"
  4. struct url_info {
  5. /* normalized url on success, must be freed, otherwise NULL */
  6. char *url;
  7. /* if !url, a brief reason for the failure, otherwise NULL */
  8. const char *err;
  9. /* the rest of the fields are only set if url != NULL */
  10. size_t url_len; /* total length of url (which is now normalized) */
  11. size_t scheme_len; /* length of scheme name (excluding final :) */
  12. size_t user_off; /* offset into url to start of user name (0 => none) */
  13. size_t user_len; /* length of user name; if user_off != 0 but
  14. user_len == 0, an empty user name was given */
  15. size_t passwd_off; /* offset into url to start of passwd (0 => none) */
  16. size_t passwd_len; /* length of passwd; if passwd_off != 0 but
  17. passwd_len == 0, an empty passwd was given */
  18. size_t host_off; /* offset into url to start of host name (0 => none) */
  19. size_t host_len; /* length of host name;
  20. * file urls may have host_len == 0 */
  21. size_t port_off; /* offset into url to start of port number (0 => none) */
  22. size_t port_len; /* if a portnum is present (port_off != 0), it has
  23. * this length (excluding the leading ':') starting
  24. * from port_off (always 0 for file urls) */
  25. size_t path_off; /* offset into url to the start of the url path;
  26. * this will always point to a '/' character
  27. * after the url has been normalized */
  28. size_t path_len; /* length of path portion excluding any trailing
  29. * '?...' and '#...' portion; will always be >= 1 */
  30. };
  31. char *url_normalize(const char *, struct url_info *);
  32. struct urlmatch_item {
  33. size_t hostmatch_len;
  34. size_t pathmatch_len;
  35. char user_matched;
  36. };
  37. struct urlmatch_config {
  38. struct string_list vars;
  39. struct url_info url;
  40. const char *section;
  41. const char *key;
  42. void *cb;
  43. int (*collect_fn)(const char *var, const char *value, void *cb);
  44. int (*cascade_fn)(const char *var, const char *value, void *cb);
  45. };
  46. int urlmatch_config_entry(const char *var, const char *value, void *cb);
  47. #endif /* URL_MATCH_H */