exthttpcodes.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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_PROXY_REQUEST_CANCELED = 1051,
  52. // Custom (replace HTTP 200/304)
  53. EXT_HTTP_EXT_SUCCESS_BEGIN = 2000, // to check if code variable is in success interval
  54. EXT_HTTP_MIRRMOVE = 2000,
  55. EXT_HTTP_MANUAL_DELETE = 2001,
  56. EXT_HTTP_NOTUSED2 = 2002,
  57. EXT_HTTP_NOTUSED3 = 2003,
  58. EXT_HTTP_REFRESH = 2004,
  59. EXT_HTTP_NOINDEX = 2005,
  60. EXT_HTTP_BADCODES = 2006,
  61. EXT_HTTP_SITESTAT = 2007,
  62. EXT_HTTP_IOERROR = 2008,
  63. EXT_HTTP_BASEERROR = 2009,
  64. EXT_HTTP_PARSERROR = 2010,
  65. EXT_HTTP_BAD_CHARSET = 2011,
  66. EXT_HTTP_BAD_LANGUAGE = 2012,
  67. EXT_HTTP_NUMERERROR = 2013,
  68. EXT_HTTP_EMPTYDOC = 2014,
  69. EXT_HTTP_HUGEDOC = 2015,
  70. EXT_HTTP_LINKGARBAGE = 2016,
  71. EXT_HTTP_EXDUPLICATE = 2017,
  72. EXT_HTTP_FILTERED = 2018,
  73. EXT_HTTP_PARSERFAIL = 2019, // parser crashed (in this case image spider will redownload such document)
  74. EXT_HTTP_GZIPERROR = 2020,
  75. EXT_HTTP_CLEANPARAM = 2021,
  76. EXT_HTTP_MANUAL_DELETE_URL = 2022,
  77. EXT_HTTP_CUSTOM_PARTIAL_CONTENT = 2023,
  78. EXT_HTTP_EMPTY_RESPONSE = 2024,
  79. EXT_HTTP_REL_CANONICAL = 2025,
  80. EXT_HTTP_EXT_SUCCESS_END = 3000, // to check if code variable is in success interval
  81. EXT_HTTP_HOSTFILTER = 3001,
  82. EXT_HTTP_URLFILTER = 3002,
  83. EXT_HTTP_SUFFIXFILTER = 3003,
  84. EXT_HTTP_DOMAINFILTER = 3004,
  85. EXT_HTTP_EXTDOMAINFILTER = 3005,
  86. EXT_HTTP_PORTFILTER = 3006,
  87. EXT_HTTP_MIRROR = 3007,
  88. EXT_HTTP_DEEPDIR = 3008,
  89. EXT_HTTP_DUPDIRS = 3009,
  90. EXT_HTTP_REGEXP = 3010,
  91. EXT_HTTP_OLDDELETED = 3012,
  92. EXT_HTTP_PENALTY = 3013,
  93. EXT_HTTP_POLICY = 3015,
  94. EXT_HTTP_TOOOLD = 3016,
  95. EXT_HTTP_GARBAGE = 3017,
  96. EXT_HTTP_FOREIGN = 3018,
  97. EXT_HTTP_EXT_REGEXP = 3019,
  98. EXT_HTTP_HOPS = 3020,
  99. EXT_HTTP_SELRANK = 3021,
  100. EXT_HTTP_NOLINKS = 3022,
  101. EXT_HTTP_WRONGMULTILANG = 3023,
  102. EXT_HTTP_SOFTMIRRORS = 3024,
  103. EXT_HTTP_BIGLEVEL = 3025,
  104. // fast robot codes
  105. EXT_HTTP_FASTHOPS = 4000,
  106. EXT_HTTP_NODOC = 4001,
  107. EXT_HTTP_MAX
  108. };
  109. enum HttpFlags {
  110. // connection
  111. ShouldDisconnect = 1,
  112. ShouldRetry = 2,
  113. // UNUSED 4
  114. // indexer
  115. ShouldReindex = 8,
  116. ShouldDelete = 16,
  117. CheckLocation = 32,
  118. CheckLinks = 64,
  119. MarkSuspect = 128,
  120. // UNUSED 256
  121. // UNUSED 512
  122. MoveRedir = 1024,
  123. CanBeFake = 2048,
  124. };
  125. const size_t EXT_HTTP_CODE_MAX = 1 << 12;
  126. static inline int Http2Status(int code) {
  127. extern ui16* http2status;
  128. return http2status[code & (EXT_HTTP_CODE_MAX - 1)];
  129. }
  130. TStringBuf ExtHttpCodeStr(int code) noexcept;