// File: mbourand[P]webserv/srcs/Request.cpp
// Function: Request::parse_method()
void Request::parse_method()
{
	std::string method = _raw.substr(0, _raw.find(' '));
	if (!g_webserv.methods.hasCandidates(method) || method.empty())
	{
		_error_code = 400;
		throw std::invalid_argument("Method could not be recognized.");
	}
	if (ft::contains(_raw, ' ') && g_webserv.methods.getByType(method) != NULL)
	{
		Logger::print("Request method is " + method + ".", true, INFO, VERBOSE);
		_method = g_webserv.methods.getByType(method);
		_parse_start = _raw.find(' ');
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
addq $0x8, %rdi
movq %rdi, -0x98(%rbp)
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x90(%rbp)
movl $0x20, %esi
callq 0x9860
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq %rax, %rcx
leaq -0x28(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x96b0
movq -0x88(%rbp), %rsi
leaq 0x30ae7(%rip), %rdi     # 0x8f720
addq $0x68, %rdi
callq 0x61870
movb %al, -0x79(%rbp)
jmp 0x5ec47
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x5ec50
jmp 0x5ec62
leaq -0x28(%rbp), %rdi
callq 0x9a50
testb $0x1, %al
jne 0x5ec62
jmp 0x5ece5
movq -0xa0(%rbp), %rax
movl $0x190, 0x188(%rax)     # imm = 0x190
movl $0x10, %edi
callq 0x9340
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
leaq 0xee6e(%rip), %rsi      # 0x6daff
callq 0x9be0
jmp 0x5ec98
movq -0xa8(%rbp), %rdi
movq 0x30322(%rip), %rsi     # 0x8efc8
movq 0x3030b(%rip), %rdx     # 0x8efb8
callq 0x9aa0
jmp 0x5ee52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x5ee40
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x94c0
jmp 0x5ee40
movq -0xa0(%rbp), %rdi
addq $0x8, %rdi
movb $0x20, -0x35(%rbp)
leaq -0x35(%rbp), %rsi
callq 0x143d0
movb %al, -0xa9(%rbp)
jmp 0x5ed05
movb -0xa9(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xaa(%rbp)
jne 0x5ed1a
jmp 0x5ed4b
leaq 0x309ff(%rip), %rdi     # 0x8f720
addq $0x68, %rdi
leaq -0x28(%rbp), %rsi
callq 0x4df00
movq %rax, -0xb8(%rbp)
jmp 0x5ed37
movq -0xb8(%rbp), %rax
cmpq $0x0, %rax
setne %al
movb %al, -0xaa(%rbp)
movb -0xaa(%rbp), %al
testb $0x1, %al
jne 0x5ed5a
jmp 0x5ee2e
leaq 0xedbe(%rip), %rsi      # 0x6db1f
leaq -0x78(%rbp), %rdi
leaq -0x28(%rbp), %rdx
callq 0x14000
jmp 0x5ed70
leaq 0xec79(%rip), %rdx      # 0x6d9f0
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x13970
jmp 0x5ed86
leaq -0x58(%rbp), %rdi
movl $0x1, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x5bdc0
jmp 0x5ed9a
leaq -0x58(%rbp), %rdi
callq 0x9c98
leaq -0x78(%rbp), %rdi
callq 0x9c98
leaq 0x3096d(%rip), %rdi     # 0x8f720
addq $0x68, %rdi
leaq -0x28(%rbp), %rsi
callq 0x4df00
movq %rax, -0xc0(%rbp)
jmp 0x5edc9
movq -0xa0(%rbp), %rdi
movq -0xc0(%rbp), %rax
movq %rax, 0x28(%rdi)
addq $0x8, %rdi
movl $0x20, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x9860
movq %rax, %rcx
movq -0xa0(%rbp), %rax
movq %rcx, 0x198(%rax)
jmp 0x5ee2e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x5ee23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x9c98
leaq -0x78(%rbp), %rdi
callq 0x9c98
jmp 0x5ee40
leaq -0x28(%rbp), %rdi
callq 0x9c98
addq $0xc0, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x9c98
movq -0x30(%rbp), %rdi
callq 0x9af0
nopw %cs:(%rax,%rax)