// File: guoxuanhan[P]NetServer/httpsession.cpp
// Function: HttpSession::HttpError(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, _HttpRequestContext const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
void HttpSession::HttpError(const int err_num, const std::string short_msg, const HttpRequestContext &httprequestcontext, std::string &responsecontext)
{
    //这里string创建销毁应该会耗时间
    std::string responsebody;
    responsebody += "<html><title>出错了</title>";
    responsebody += "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head>";
    responsebody += "<style>body{background-color:#f;font-size:14px;}h1{font-size:60px;color:#eeetext-align:center;padding-top:30px;font-weight:normal;}</style>";
    responsebody += "<body bgcolor=\"ffffff\"><h1>";
    responsebody += std::to_string(err_num) + " " + short_msg;
    responsebody += "</h1><hr><em> GuoJ's NetServer</em>\n</body></html>";

    std::string httpversion;
    if(httprequestcontext.version.empty())
    {
        httpversion = "HTTP/1.1";
    }
    else
    {
        httpversion = httprequestcontext.version;
    }

    responsecontext += httpversion + " " + std::to_string(err_num) + " " + short_msg + "\r\n";
    responsecontext += "Server: GuoJ's NetServer/0.1\r\n";
    responsecontext += "Content-Type: text/html\r\n";
    responsecontext += "Connection: Keep-Alive\r\n";
    responsecontext += "Content-Length: " + std::to_string(responsebody.size()) + "\r\n";
    responsecontext += "\r\n";
    responsecontext += responsebody;
}

// Assembly:
subq $0x208, %rsp            # imm = 0x208
movq %rdx, (%rsp)
movq %rdi, 0x200(%rsp)
movl %esi, 0x1fc(%rsp)
movq %rdx, 0x1f0(%rsp)
movq %rcx, 0x1e8(%rsp)
movq %r8, 0x1e0(%rsp)
leaq 0x1c0(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x54f0
movq 0x8(%rsp), %rdi
leaq 0x126b4(%rip), %rsi     # 0x28b94
callq 0x5380
jmp 0x164e7
leaq 0x126c5(%rip), %rsi     # 0x28bb3
leaq 0x1c0(%rsp), %rdi
callq 0x5380
jmp 0x164fd
leaq 0x12700(%rip), %rsi     # 0x28c04
leaq 0x1c0(%rsp), %rdi
callq 0x5380
jmp 0x16513
leaq 0x12776(%rip), %rsi     # 0x28c90
leaq 0x1c0(%rsp), %rdi
callq 0x5380
jmp 0x16529
movl 0x1fc(%rsp), %esi
leaq 0x150(%rsp), %rdi
callq 0x17000
jmp 0x1653f
leaq 0x11eed(%rip), %rdx     # 0x28433
leaq 0x170(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x16ce0
jmp 0x1655d
movq (%rsp), %rdx
leaq 0x190(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x16fb0
jmp 0x16578
leaq 0x1c0(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x54a0
jmp 0x1658f
leaq 0x190(%rsp), %rdi
callq 0x5270
leaq 0x170(%rsp), %rdi
callq 0x5270
leaq 0x150(%rsp), %rdi
callq 0x5270
leaq 0x126ef(%rip), %rsi     # 0x28cac
leaq 0x1c0(%rsp), %rdi
callq 0x5380
jmp 0x165cc
leaq 0x130(%rsp), %rdi
callq 0x54f0
movq 0x1e8(%rsp), %rdi
addq $0x40, %rdi
callq 0x55f0
testb $0x1, %al
jne 0x165f3
jmp 0x166ac
leaq 0x124e5(%rip), %rsi     # 0x28adf
leaq 0x130(%rsp), %rdi
callq 0x54c0
jmp 0x16609
jmp 0x166c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x16a1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x16681
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x16674
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
leaq 0x190(%rsp), %rdi
callq 0x5270
leaq 0x170(%rsp), %rdi
callq 0x5270
leaq 0x150(%rsp), %rdi
callq 0x5270
jmp 0x16a1e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x16a11
movq 0x1e8(%rsp), %rsi
addq $0x40, %rsi
leaq 0x130(%rsp), %rdi
callq 0x5050
jmp 0x166c7
jmp 0x166c9
leaq 0x11d63(%rip), %rdx     # 0x28433
leaq 0x90(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x16c50
jmp 0x166e7
movl 0x1fc(%rsp), %esi
leaq 0x70(%rsp), %rdi
callq 0x17000
jmp 0x166fa
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x17140
jmp 0x16716
leaq 0x11d16(%rip), %rdx     # 0x28433
leaq 0xd0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x16ce0
jmp 0x16734
movq (%rsp), %rdx
leaq 0xf0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x16fb0
jmp 0x1674f
leaq 0x122c3(%rip), %rdx     # 0x28a19
leaq 0x110(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x16ce0
jmp 0x1676d
movq 0x1e0(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x54a0
jmp 0x16784
leaq 0x110(%rsp), %rdi
callq 0x5270
leaq 0xf0(%rsp), %rdi
callq 0x5270
leaq 0xd0(%rsp), %rdi
callq 0x5270
leaq 0xb0(%rsp), %rdi
callq 0x5270
leaq 0x70(%rsp), %rdi
callq 0x5270
leaq 0x90(%rsp), %rdi
callq 0x5270
movq 0x1e0(%rsp), %rdi
leaq 0x1233f(%rip), %rsi     # 0x28b1d
callq 0x5380
jmp 0x167e5
movq 0x1e0(%rsp), %rdi
leaq 0x124eb(%rip), %rsi     # 0x28cdf
callq 0x5380
jmp 0x167fb
movq 0x1e0(%rsp), %rdi
leaq 0x124ef(%rip), %rsi     # 0x28cf9
callq 0x5380
jmp 0x16811
leaq 0x1c0(%rsp), %rdi
callq 0x52b0
movq %rax, %rsi
leaq 0x10(%rsp), %rdi
callq 0x16eb0
jmp 0x1682d
leaq 0x12336(%rip), %rsi     # 0x28b6a
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x16e60
jmp 0x16845
leaq 0x121cd(%rip), %rdx     # 0x28a19
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x16ce0
jmp 0x1685d
movq 0x1e0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x54a0
jmp 0x16871
leaq 0x50(%rsp), %rdi
callq 0x5270
leaq 0x30(%rsp), %rdi
callq 0x5270
leaq 0x10(%rsp), %rdi
callq 0x5270
movq 0x1e0(%rsp), %rdi
leaq 0x1217b(%rip), %rsi     # 0x28a19
callq 0x5380
jmp 0x168a5
movq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x54a0
jmp 0x168bc
leaq 0x130(%rsp), %rdi
callq 0x5270
leaq 0x1c0(%rsp), %rdi
callq 0x5270
addq $0x208, %rsp            # imm = 0x208
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x169a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x1699a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x1698d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x16980
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x16973
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x5270
leaq 0xf0(%rsp), %rdi
callq 0x5270
leaq 0xd0(%rsp), %rdi
callq 0x5270
leaq 0xb0(%rsp), %rdi
callq 0x5270
leaq 0x70(%rsp), %rdi
callq 0x5270
leaq 0x90(%rsp), %rdi
callq 0x5270
jmp 0x16a11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x16a07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
jmp 0x169fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b8(%rsp)
movl %eax, 0x1b4(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x5270
leaq 0x30(%rsp), %rdi
callq 0x5270
leaq 0x10(%rsp), %rdi
callq 0x5270
leaq 0x130(%rsp), %rdi
callq 0x5270
leaq 0x1c0(%rsp), %rdi
callq 0x5270
movq 0x1b8(%rsp), %rdi
callq 0x5660
nopl (%rax,%rax)