Skip to content

Instantly share code, notes, and snippets.

@xgqfrms-GitHub
Last active February 17, 2023 09:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms-GitHub/3c1df86c0cca4281516ddbb7132f77c3 to your computer and use it in GitHub Desktop.
Save xgqfrms-GitHub/3c1df86c0cca4281516ddbb7132f77c3 to your computer and use it in GitHub Desktop.
HTTP Status Codes

HTTP Status Codes

# 1×× Informational

100 Continue
101 Switching Protocols
102 Processing

# 2×× Success

200 OK
201 Created
202 Accepted
203 Non-authoritative Information
204 No Content
205 Reset Content
206 Partial Content
207 Multi-Status
208 Already Reported
226 IM Used

# 3×× Redirection

300 Multiple Choices
301 Moved Permanently
302 Found
303 See Other
304 Not Modified
305 Use Proxy
307 Temporary Redirect
308 Permanent Redirect

# 4×× Client Error

400 Bad Request
401 Unauthorized
402 Payment Required
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Payload Too Large
414 Request-URI Too Long
415 Unsupported Media Type
416 Requested Range Not Satisfiable
417 Expectation Failed
418 I'm a teapot
421 Misdirected Request
422 Unprocessable Entity
423 Locked
424 Failed Dependency
426 Upgrade Required
428 Precondition Required
429 Too Many Requests
431 Request Header Fields Too Large
444 Connection Closed Without Response
451 Unavailable For Legal Reasons
499 Client Closed Request

# 5×× Server Error

500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported
506 Variant Also Negotiates
507 Insufficient Storage
508 Loop Detected
510 Not Extended
511 Network Authentication Required
599 Network Connect Timeout Error

httpstatuses

https://httpstatuses.com/405

CheckUpDown

http://www.checkupdown.com/status/E405_zh.html

json

https://jsonformatter.curiousconcept.com/

en-US/en-UK

{
    "1×× Informational":{
        "100":"Continue",
        "101":"Switching Protocols",
        "102":"Processing"
    },
    "2×× Success":{
        "200":"OK",
        "201":"Created",
        "202":"Accepted",
        "203":"Non-authoritative Information",
        "204":"No Content",
        "205":"Reset Content",
        "206":"Partial Content",
        "207":"Multi-Status",
        "208":"Already Reported",
        "226":"IM Used"
    },
    "3×× Redirection":{
        "300":"Multiple Choices",
        "301":"Moved Permanently",
        "302":"Found",
        "303":"See Other",
        "304":"Not Modified",
        "305":"Use Proxy",
        "307":"Temporary Redirect",
        "308":"Permanent Redirect"
    },
    "4×× Client Error":{
        "400":"Bad Request",
        "401":"Unauthorized",
        "402":"Payment Required",
        "403":"Forbidden",
        "404":"Not Found",
        "405":"Method Not Allowed",
        "406":"Not Acceptable",
        "407":"Proxy Authentication Required",
        "408":"Request Timeout",
        "409":"Conflict",
        "410":"Gone",
        "411":"Length Required",
        "412":"Precondition Failed",
        "413":"Payload Too Large",
        "414":"Request-URI Too Long",
        "415":"Unsupported Media Type",
        "416":"Requested Range Not Satisfiable",
        "417":"Expectation Failed",
        "418":"I'm a teapot",
        "421":"Misdirected Request",
        "422":"Unprocessable Entity",
        "423":"Locked",
        "424":"Failed Dependency",
        "426":"Upgrade Required",
        "428":"Precondition Required",
        "429":"Too Many Requests",
        "431":"Request Header Fields Too Large",
        "444":"Connection Closed Without Response",
        "451":"Unavailable For Legal Reasons",
        "499":"Client Closed Request"
    },
    "5×× Server Error":{
        "500":"Internal Server Error",
        "501":"Not Implemented",
        "502":"Bad Gateway",
        "503":"Service Unavailable",
        "504":"Gateway Timeout",
        "505":"HTTP Version Not Supported",
        "506":"Variant Also Negotiates",
        "507":"Insufficient Storage",
        "508":"Loop Detected",
        "510":"Not Extended",
        "511":"Network Authentication Required",
        "599":"Network Connect Timeout Error"
    }
}

zh-CN/zh-Hans

{
    "http-status-codes-urls":{
        "httpstatuses.com":"https://httpstatuses.com",
        "checkupdown.com":"http://www.checkupdown.com/status/",
        "gist.github.com":"https://gist.github.com/xgqfrms-GitHub/3c1df86c0cca4281516ddbb7132f77c3"
    },
    "1×× 信息":{
        "100":"继续",
        "101":"交换协议",
        "102":"处理"
    },
    "2×× 成功":{
        "200":"OK",
        "201":"创建",
        "202":"接受",
        "203":"非授权信息",
        "204":"无内容",
        "205":"重置内容",
        "206":"部分内容",
        "207":"多状态",
        "208":"已报告",
        "226":"IM已使用"
    },
    "3×× 重定向":{
        "300":"多种选择",
        "301":"永久移动",
        "302":"发现",
        "303":"见其他",
        "304":"未修改",
        "305":"使用代理",
        "307":"暂时重定向",
        "308":"永久重定向"
    },
    "4×× 客户端错误":{
        "400":"错误的请求",
        "401":"未经授权",
        "402":"需要付款",
        "403":"被禁止",
        "404":"未找到",
        "405":"不允许的方法",
        "406":"不可接受的",
        "407":"需要代理认证",
        "408":"请求超时",
        "409":"冲突",
        "410":"过去的",
        "411":"需要长度",
        "412":"前提条件失败",
        "413":"有效负载太大",
        "414":"请求URI太长",
        "415":"不支持的媒体类型",
        "416":"请求范围不满意",
        "417":"期待失败",
        "418":"我是一个茶壶",
        "421":"错误的请求",
        "422":"不可处理的实体",
        "423":"锁定",
        "424":"失败的依赖关系",
        "426":"需要升级",
        "428":"需要前提条件",
        "429":"太多请求",
        "431":"请求头字段太大了",
        "444":"连接关闭没有响应",
        "451":"不可用因为合法原因",
        "499":"客户关闭请求"
    },
    "5×× 服务器错误":{
        "500":"内部服务器错误",
        "501":"未实现",
        "502":"错误的网关",
        "503":"暂停服务/服务不可用",
        "504":"网关超时",
        "505":"不支持的HTTP版本",
        "506":"变种另外协商",
        "507":"存储空间不足",
        "508":"检测到环路",
        "510":"不扩展",
        "511":"需要网络认证",
        "599":"网络连接超时错误"
    }
}
@xgqfrms-GitHub
Copy link
Author

DDOS

@xgqfrms-GitHub
Copy link
Author

Application Cache API & Service Workers

@xgqfrms-GitHub
Copy link
Author

?

{
    "400":"请求出现语法错误",
    "401":"没有访问权限",
    "403":"服务器拒绝执行该请求",
    "404":"指定的页面不存在",
    "405":"请求方法对指定的资源不适用",
    "406":"客户端无法接受相应数据",
    "408":"等待请求时服务器超时",
    "409":"请求与当前资源的状态冲突,导致请求无法完成",
    "410":"请求的资源已不存在,并且没有转接地址",
    "500":"服务器尝试执行请求时遇到了意外情况",
    "501":"服务器不具备执行该请求所需的功能",
    "502":"网关或代理服务器从上游服务器收到的响应无效",
    "503":"服务器暂时无法处理该请求",
    "504":"在等待上游服务器响应时,网关或代理服务器超时",
    "505":"服务器不支持请求中所用的 HTTP 版本",
    "1":"无法解析服务器的 DNS 地址",
    "2":"连接失败",
    "-7":"操作超时",
    "-100":"服务器意外关闭了连接",
    "-101":"连接已重置",
    "-102":"服务器拒绝了连接",
    "-104":"无法连接到服务器",
    "-105":"无法解析服务器的 DNS 地址",
    "-109":"无法访问该服务器",
    "-138":"无法访问网络",
    "-130":"代理服务器连接失败",
    "-106":"互联网连接已中断",
    "-401":"从缓存中读取数据时出现错误",
    "-400":"缓存中未找到请求的条目",
    "-331":"网络 IO 已暂停",
    "-6":"无法找到该文件或目录",
    "-310":"重定向过多",
    "-324":"服务器已断开连接,且未发送任何数据",
    "-346":"收到了来自服务器的重复标头",
    "-349":"收到了来自服务器的重复标头",
    "-350":"收到了来自服务器的重复标头",
    "-118":"连接超时"
}

@xgqfrms-GitHub
Copy link
Author

xgqfrms-GitHub commented Apr 4, 2017

jQuery ImgError

https://jsfiddle.net/dorathoto/8z4Ltzp8/

jQuery/JavaScript to replace broken images

https://stackoverflow.com/questions/92720/jquery-javascript-to-replace-broken-images?noredirect=1&lq=1

function imgError(image) {
    image.onerror = "";
    image.src = "/images/noimage.gif";
    return true;
}
<img src="image.png" onerror="imgError(this);"/>

How to detect on-page 404 errors using JavaScript? 如何使用JavaScript检测页面404错误?

https://stackoverflow.com/questions/8504673/how-to-detect-on-page-404-errors-using-javascript

window.addEventListener('error', function(e) {
    console.log(e);
}, true);
var srcFrom = {
    html:function(str){
        var prs = new DOMParser();
        var obj = prs.parseFromString(str, 'text/html');
        var rsl = [], nds;
        ['data', 'href', 'src'].forEach(function(atr){
            nds = [].slice.call(obj.querySelectorAll('['+atr+']'));
            nds.forEach(function(nde)
            { rsl[rsl.length] = nde.getAttribute(atr); });
        });
        return rsl;
    },
    css:function(str){
        var css = document.createElement('style');
        var rsl = [], nds, tmp;
        css.id = 'cssTest';
        css.innerHTML = str;
        document.head.appendChild(css);
        css = [].slice.call(document.styleSheets);
        for (var idx in css) {
            if (css[idx].ownerNode.id == 'cssTest'){
                [].slice.call(css[idx].cssRules).forEach(function(ssn) {
                    ['src', 'backgroundImage'].forEach(function(pty){
                        if (ssn.style[pty].length > 0){
                            tmp = ssn.style[pty].slice(4, -1);
                            tmp = tmp.split(window.location.pathname).join('');
                            tmp = tmp.split(window.location.origin).join('');
                            tmp = ((tmp[0] == '/') ? tmp.substr(1) : tmp);
                            rsl[rsl.length] = tmp;
                        }
                    });
                });
                break;
            }
        }
        css = document.getElementById('cssTest');
        css.parentNode.removeChild(css);
        return rsl;
    }
};


function check_file(url, cbf){
    var xhr = new XMLHttpRequest();
    var uri = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.onload = function(){
        var ext = url.split('.').pop();
        var lst = srcFrom[ext](this.response);
        var rsl = [null, null], nds;
        var Break = {};
        try{
            lst.forEach(function(tgt){
                uri.open('GET', tgt, false);
                uri.send(null);
                if (uri.statusText != 'OK'){
                    rsl = [uri.statusText, tgt];
                    throw Break;
                }
            });
        }
        catch(e){}
        cbf(rsl[0], rsl[1]);
    };
    xhr.send(null);
}

var uri = 'https://learning.xgqfrms.xyz/test.html';   

check_file(uri, function(err, pth){
    if (err){ 
         document.write('Aw Snap! "'+pth+'" is missing !'); 
   }
});

@xgqfrms-GitHub
Copy link
Author

xgqfrms-GitHub commented Apr 4, 2017

506-variant-also-negotiates

服务器具有内部配置错误:所选的变体资源被配置为参与透明内容协商本身,因此在协商过程中不是正确的终点。
https://httpstatusdogs.com/506-variant-also-negotiates
https://httpstatuses.com/506
http://www.masswerk.at/status/?506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment