ClientToProxyConnection.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:little_mitm 作者:
private void writeAuthenticationRequired(String realm) {
    String body = "<!DOCTYPE HTML \"-//IETF//DTD HTML 2.0//EN\">\n"
            + "<html><head>\n"
            + "<title>407 Proxy Authentication Required</title>\n"
            + "</head><body>\n"
            + "<h1>Proxy Authentication Required</h1>\n"
            + "<p>This server could not verify that you\n"
            + "are authorized to access the document\n"
            + "requested.  Either you supplied the wrong\n"
            + "credentials (e.g., bad password), or your\n"
            + "browser doesn't understand how to supply\n"
            + "the credentials required.</p>\n" + "</body></html>\n";
    DefaultFullHttpResponse response = responseFor(HttpVersion.HTTP_1_1,
            HttpResponseStatus.PROXY_AUTHENTICATION_REQUIRED, body);
    HttpHeaders.setDate(response, new Date());
    response.headers().set("Proxy-Authenticate",
            "Basic realm=\"" + (realm == null ? "Restricted Files" : realm) + "\"");
    write(response);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号