// File: DMLfor[P]TinyWebServer/./ServerBase.hpp
// Function: WebServer::ServerBase<boost::asio::ssl::stream<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0>>, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0>>>>>>::parse_request(std::istream&) const
WebServer::Request WebServer::ServerBase<socket_type>::parse_request(std::istream &stream) const
{
	Request request;
	// 使用正则表达式对请求报头进行解析
	// 可以解析出请求方法(GET/POST),请求路径以及 HTTP 版本
	std::regex e("^([^ ]*) ([^ ]*) HTTP/([^ ]*)$");

	std::smatch sub_match;
	// 从第一行中解析请求的方法, 路径和 HTTP 版本
	std::string line;
	getline(stream, line);
	line.pop_back();
	if(std::regex_match(line, sub_match, e))
	{
		request.method        = sub_match[1];
		request.path		  = sub_match[2];
		request.http_version  = sub_match[3];
		// 解析头部的其他信息
		bool matched = false;
		e = "^([^:]*): ?(.*)$";
		do
		{
			getline(stream, line);
			line.pop_back();
			matched = std::regex_match(line, sub_match, e);
			if(matched)
			{
				request.header[sub_match[1]] = sub_match[2];
			}
		} while(matched);
	}
	return request;
}

// Assembly:
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, 0x80(%rsp)
movq %rdi, %rax
movq %rax, 0x88(%rsp)
movq %rdi, 0x1c0(%rsp)
movq %rsi, 0x1b8(%rsp)
movq %rdx, 0x1b0(%rsp)
movb $0x0, 0x1af(%rsp)
callq 0x3bd20
leaq 0x3f17a(%rip), %rsi     # 0x79c10
leaq 0x188(%rsp), %rdi
movl $0x10, %edx
callq 0x3c8c0
jmp 0x3aaaa
leaq 0x158(%rsp), %rdi
callq 0x3be10
jmp 0x3aab9
leaq 0x138(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xc490
movq 0x78(%rsp), %rsi
movq 0x1b0(%rsp), %rdi
callq 0xc6e0
jmp 0x3aadf
leaq 0x138(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0xc820
movq 0x68(%rsp), %rdi
leaq 0x158(%rsp), %rsi
leaq 0x188(%rsp), %rdx
xorl %ecx, %ecx
callq 0x3c970
movb %al, 0x77(%rsp)
jmp 0x3ab13
movb 0x77(%rsp), %al
testb $0x1, %al
jne 0x3ab20
jmp 0x3adf9
leaq 0x158(%rsp), %rdi
movl $0x1, %esi
callq 0x3c9d0
movq %rax, 0x60(%rsp)
jmp 0x3ab39
movq 0x60(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x3ca40
jmp 0x3ab4d
movq 0x80(%rsp), %rdi
leaq 0x118(%rsp), %rsi
movq %rsi, 0x50(%rsp)
callq 0xc720
movq 0x50(%rsp), %rdi
callq 0xc9e0
leaq 0x158(%rsp), %rdi
movl $0x2, %esi
callq 0x3c9d0
movq %rax, 0x58(%rsp)
jmp 0x3ab8a
movq 0x58(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0x3ca40
jmp 0x3ab9e
movq 0x80(%rsp), %rdi
addq $0x20, %rdi
leaq 0xf8(%rsp), %rsi
movq %rsi, 0x40(%rsp)
callq 0xc720
movq 0x40(%rsp), %rdi
callq 0xc9e0
leaq 0x158(%rsp), %rdi
movl $0x3, %esi
callq 0x3c9d0
movq %rax, 0x48(%rsp)
jmp 0x3abdf
movq 0x48(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
callq 0x3ca40
jmp 0x3abf3
movq 0x80(%rsp), %rdi
addq $0x40, %rdi
leaq 0xd8(%rsp), %rsi
movq %rsi, 0x38(%rsp)
callq 0xc720
movq 0x38(%rsp), %rdi
callq 0xc9e0
movb $0x0, 0xd7(%rsp)
leaq 0x3f005(%rip), %rsi     # 0x79c2f
leaq 0x188(%rsp), %rdi
callq 0x3ca70
jmp 0x3ac39
jmp 0x3ac3b
movq 0x1b0(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0xc6e0
jmp 0x3ac52
leaq 0x138(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xc820
movq 0x28(%rsp), %rdi
leaq 0x158(%rsp), %rsi
leaq 0x188(%rsp), %rdx
xorl %ecx, %ecx
callq 0x3c970
movb %al, 0x37(%rsp)
jmp 0x3ac86
movb 0x37(%rsp), %al
andb $0x1, %al
movb %al, 0xd7(%rsp)
testb $0x1, 0xd7(%rsp)
je 0x3ade7
leaq 0x158(%rsp), %rdi
movl $0x2, %esi
callq 0x3c9d0
movq %rax, 0x20(%rsp)
jmp 0x3acba
movq 0x20(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x3ca40
jmp 0x3acce
movq 0x80(%rsp), %rax
addq $0x70, %rax
movq %rax, 0x10(%rsp)
leaq 0x158(%rsp), %rdi
movl $0x1, %esi
callq 0x3c9d0
movq %rax, 0x18(%rsp)
jmp 0x3acf8
movq 0x18(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0x3ca40
jmp 0x3ad0c
movq 0x10(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x3b100
movq %rax, 0x8(%rsp)
jmp 0x3ad25
movq 0x8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0xc720
leaq 0x90(%rsp), %rdi
callq 0xc9e0
leaq 0xb0(%rsp), %rdi
callq 0xc9e0
jmp 0x3ade7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x180(%rsp)
movl %eax, 0x17c(%rsp)
jmp 0x3ae7a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x180(%rsp)
movl %eax, 0x17c(%rsp)
jmp 0x3ae4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x180(%rsp)
movl %eax, 0x17c(%rsp)
jmp 0x3ae34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x180(%rsp)
movl %eax, 0x17c(%rsp)
jmp 0x3add8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x180(%rsp)
movl %eax, 0x17c(%rsp)
leaq 0x90(%rsp), %rdi
callq 0xc9e0
leaq 0xb0(%rsp), %rdi
callq 0xc9e0
jmp 0x3ae34
jmp 0x3ade9
testb $0x1, 0xd7(%rsp)
jne 0x3ac3b
jmp 0x3adf9
movb $0x1, 0x1af(%rsp)
leaq 0x138(%rsp), %rdi
callq 0xc9e0
leaq 0x158(%rsp), %rdi
callq 0x3caa0
leaq 0x188(%rsp), %rdi
callq 0x3cab0
testb $0x1, 0x1af(%rsp)
jne 0x3ae6a
jmp 0x3ae5d
leaq 0x138(%rsp), %rdi
callq 0xc9e0
leaq 0x158(%rsp), %rdi
callq 0x3caa0
leaq 0x188(%rsp), %rdi
callq 0x3cab0
jmp 0x3ae7a
movq 0x80(%rsp), %rdi
callq 0x3af70
movq 0x88(%rsp), %rax
addq $0x1c8, %rsp            # imm = 0x1C8
retq
movq 0x80(%rsp), %rdi
callq 0x3af70
movq 0x180(%rsp), %rdi
callq 0xc900
nopw %cs:(%rax,%rax)
nop