exthttpcodes.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #pragma once
  2. #include <util/system/defaults.h>
  3. #include <library/cpp/http/misc/httpcodes.h>
  4. enum ExtHttpCodes {
  5. // Custom
  6. HTTP_EXTENDED = 1000,
  7. HTTP_BAD_RESPONSE_HEADER = 1000,
  8. HTTP_CONNECTION_LOST = 1001,
  9. HTTP_BODY_TOO_LARGE = 1002,
  10. HTTP_ROBOTS_TXT_DISALLOW = 1003,
  11. HTTP_BAD_URL = 1004,
  12. HTTP_BAD_MIME = 1005,
  13. HTTP_DNS_FAILURE = 1006,
  14. HTTP_BAD_STATUS_CODE = 1007,
  15. HTTP_BAD_HEADER_STRING = 1008,
  16. HTTP_BAD_CHUNK = 1009,
  17. HTTP_CONNECT_FAILED = 1010,
  18. HTTP_FILTER_DISALLOW = 1011,
  19. HTTP_LOCAL_EIO = 1012,
  20. HTTP_BAD_CONTENT_LENGTH = 1013,
  21. HTTP_BAD_ENCODING = 1014,
  22. HTTP_LENGTH_UNKNOWN = 1015,
  23. HTTP_HEADER_EOF = 1016,
  24. HTTP_MESSAGE_EOF = 1017,
  25. HTTP_CHUNK_EOF = 1018,
  26. HTTP_PAST_EOF = 1019,
  27. HTTP_HEADER_TOO_LARGE = 1020,
  28. HTTP_URL_TOO_LARGE = 1021,
  29. HTTP_INTERRUPTED = 1022,
  30. HTTP_CUSTOM_NOT_MODIFIED = 1023,
  31. HTTP_BAD_CONTENT_ENCODING = 1024,
  32. HTTP_NO_RESOURCES = 1025,
  33. HTTP_FETCHER_SHUTDOWN = 1026,
  34. HTTP_CHUNK_TOO_LARGE = 1027,
  35. HTTP_SERVER_BUSY = 1028,
  36. HTTP_SERVICE_UNKNOWN = 1029,
  37. HTTP_PROXY_UNKNOWN = 1030,
  38. HTTP_PROXY_REQUEST_TIME_OUT = 1031,
  39. HTTP_PROXY_INTERNAL_ERROR = 1032,
  40. HTTP_PROXY_CONNECT_FAILED = 1033,
  41. HTTP_PROXY_CONNECTION_LOST = 1034,
  42. HTTP_PROXY_NO_PROXY = 1035,
  43. HTTP_PROXY_ERROR = 1036,
  44. HTTP_SSL_ERROR = 1037,
  45. HTTP_CACHED_COPY_NOT_FOUND = 1038,
  46. HTTP_TIMEDOUT_WHILE_BYTES_RECEIVING = 1039,
  47. HTTP_FETCHER_BAD_RESPONSE = 1040,
  48. HTTP_FETCHER_MB_ERROR = 1041,
  49. HTTP_SSL_CERT_ERROR = 1042,
  50. HTTP_FIREWALL_REJECT = 1043,
  51. HTTP_INTERNAL_DNS_ERROR = 1047,
  52. HTTP_PROXY_REQUEST_CANCELED = 1051,
  53. // Custom (replace HTTP 200/304)
  54. EXT_HTTP_EXT_SUCCESS_BEGIN = 2000, // to check if code variable is in success interval
  55. EXT_HTTP_MIRRMOVE = 2000,
  56. EXT_HTTP_MANUAL_DELETE = 2001,
  57. EXT_HTTP_NOTUSED2 = 2002,
  58. EXT_HTTP_NOTUSED3 = 2003,
  59. EXT_HTTP_REFRESH = 2004,
  60. EXT_HTTP_NOINDEX = 2005,
  61. EXT_HTTP_BADCODES = 2006,
  62. EXT_HTTP_SITESTAT = 2007,
  63. EXT_HTTP_IOERROR = 2008,
  64. EXT_HTTP_BASEERROR = 2009,
  65. EXT_HTTP_PARSERROR = 2010,
  66. EXT_HTTP_BAD_CHARSET = 2011,
  67. EXT_HTTP_BAD_LANGUAGE = 2012,
  68. EXT_HTTP_NUMERERROR = 2013,
  69. EXT_HTTP_EMPTYDOC = 2014,
  70. EXT_HTTP_HUGEDOC = 2015,
  71. EXT_HTTP_LINKGARBAGE = 2016,
  72. EXT_HTTP_EXDUPLICATE = 2017,
  73. EXT_HTTP_FILTERED = 2018,
  74. EXT_HTTP_PARSERFAIL = 2019, // parser crashed (in this case image spider will redownload such document)
  75. EXT_HTTP_GZIPERROR = 2020,
  76. EXT_HTTP_CLEANPARAM = 2021,
  77. EXT_HTTP_MANUAL_DELETE_URL = 2022,
  78. EXT_HTTP_CUSTOM_PARTIAL_CONTENT = 2023,
  79. EXT_HTTP_EMPTY_RESPONSE = 2024,
  80. EXT_HTTP_REL_CANONICAL = 2025,
  81. EXT_HTTP_EXT_SUCCESS_END = 3000, // to check if code variable is in success interval
  82. EXT_HTTP_HOSTFILTER = 3001,
  83. EXT_HTTP_URLFILTER = 3002,
  84. EXT_HTTP_SUFFIXFILTER = 3003,
  85. EXT_HTTP_DOMAINFILTER = 3004,
  86. EXT_HTTP_EXTDOMAINFILTER = 3005,
  87. EXT_HTTP_PORTFILTER = 3006,
  88. EXT_HTTP_MIRROR = 3007,
  89. EXT_HTTP_DEEPDIR = 3008,
  90. EXT_HTTP_DUPDIRS = 3009,
  91. EXT_HTTP_REGEXP = 3010,
  92. EXT_HTTP_OLDDELETED = 3012,
  93. EXT_HTTP_PENALTY = 3013,
  94. EXT_HTTP_POLICY = 3015,
  95. EXT_HTTP_TOOOLD = 3016,
  96. EXT_HTTP_GARBAGE = 3017,
  97. EXT_HTTP_FOREIGN = 3018,
  98. EXT_HTTP_EXT_REGEXP = 3019,
  99. EXT_HTTP_HOPS = 3020,
  100. EXT_HTTP_SELRANK = 3021,
  101. EXT_HTTP_NOLINKS = 3022,
  102. EXT_HTTP_WRONGMULTILANG = 3023,
  103. EXT_HTTP_SOFTMIRRORS = 3024,
  104. EXT_HTTP_BIGLEVEL = 3025,
  105. // fast robot codes
  106. EXT_HTTP_FASTHOPS = 4000,
  107. EXT_HTTP_NODOC = 4001,
  108. EXT_HTTP_MAX
  109. };
  110. enum HttpFlags {
  111. // connection
  112. ShouldDisconnect = 1,
  113. ShouldRetry = 2,
  114. // UNUSED 4
  115. // indexer
  116. ShouldReindex = 8,
  117. ShouldDelete = 16,
  118. CheckLocation = 32,
  119. CheckLinks = 64,
  120. MarkSuspect = 128,
  121. // UNUSED 256
  122. // UNUSED 512
  123. MoveRedir = 1024,
  124. CanBeFake = 2048,
  125. };
  126. const size_t EXT_HTTP_CODE_MAX = 1 << 12;
  127. static inline int Http2Status(int code) {
  128. extern ui16* http2status;
  129. return http2status[code & (EXT_HTTP_CODE_MAX - 1)];
  130. }
  131. TStringBuf ExtHttpCodeStr(int code) noexcept;