// File: /workspace/github_cpp_makefile_star2_O2/qinguoyi[P]TinyWebServer/http/http_conn.cpp
// Function: http_conn::parse_request_line(char*)
http_conn::HTTP_CODE http_conn::parse_request_line(char *text)
{
    m_url = strpbrk(text, " \t");
    if (!m_url)
    {
        return BAD_REQUEST;
    }
    *m_url++ = '\0';
    char *method = text;
    if (strcasecmp(method, "GET") == 0)
        m_method = GET;
    else if (strcasecmp(method, "POST") == 0)
    {
        m_method = POST;
        cgi = 1;
    }
    else
        return BAD_REQUEST;
    m_url += strspn(m_url, " \t");
    m_version = strpbrk(m_url, " \t");
    if (!m_version)
        return BAD_REQUEST;
    *m_version++ = '\0';
    m_version += strspn(m_version, " \t");
    if (strcasecmp(m_version, "HTTP/1.1") != 0)
        return BAD_REQUEST;
    if (strncasecmp(m_url, "http://", 7) == 0)
    {
        m_url += 7;
        m_url = strchr(m_url, '/');
    }

    if (strncasecmp(m_url, "https://", 8) == 0)
    {
        m_url += 8;
        m_url = strchr(m_url, '/');
    }

    if (!m_url || m_url[0] != '/')
        return BAD_REQUEST;
    //当url为/时，显示判断界面
    if (strlen(m_url) == 1)
        strcat(m_url, "judge.html");
    m_check_state = CHECK_STATE_HEADER;
    return NO_REQUEST;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x3d9f(%rip), %rsi      # 0x8223
movq %r14, %rdi
callq 0x3620
movq %rax, 0xd10(%rbx)
pushq $0x2
popq %rbp
testq %rax, %rax
je 0x4574
movq %rax, %rcx
incq %rcx
movq %rcx, 0xd10(%rbx)
movb $0x0, (%rax)
leaq 0x3d70(%rip), %rsi      # 0x8226
movq %r14, %rdi
callq 0x3400
testl %eax, %eax
je 0x44ed
leaq 0x3d61(%rip), %rsi      # 0x822a
movq %r14, %rdi
callq 0x3400
testl %eax, %eax
jne 0x4574
movl $0x1, 0xc44(%rbx)
pushq $0x1
popq %rax
movl $0xdf4, %ecx            # imm = 0xDF4
jmp 0x44f4
xorl %eax, %eax
movl $0xc44, %ecx            # imm = 0xC44
movl %eax, (%rbx,%rcx)
movq 0xd10(%rbx), %r14
leaq 0x3d1e(%rip), %r15      # 0x8223
movq %r14, %rdi
movq %r15, %rsi
callq 0x3150
addq %rax, %r14
movq %r14, 0xd10(%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3620
movq %rax, 0xd18(%rbx)
testq %rax, %rax
je 0x4574
movq %rax, %rcx
incq %rcx
movq %rcx, 0xd18(%rbx)
movb $0x0, (%rax)
movq 0xd18(%rbx), %r14
leaq 0x3cd4(%rip), %rsi      # 0x8223
movq %r14, %rdi
callq 0x3150
addq %rax, %r14
movq %r14, 0xd18(%rbx)
leaq 0x3cc7(%rip), %rsi      # 0x822f
movq %r14, %rdi
callq 0x3400
testl %eax, %eax
je 0x4581
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xd10(%rbx), %r14
leaq 0x3ca9(%rip), %rsi      # 0x8238
pushq $0x7
popq %rdx
movq %r14, %rdi
callq 0x34d0
testl %eax, %eax
jne 0x45be
addq $0x7, %r14
movq %r14, 0xd10(%rbx)
pushq $0x2f
popq %rsi
movq %r14, %rdi
callq 0x3130
movq %rax, %r14
movq %rax, 0xd10(%rbx)
leaq 0x3c7b(%rip), %rsi      # 0x8240
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x34d0
testl %eax, %eax
jne 0x45f4
addq $0x8, %r14
movq %r14, 0xd10(%rbx)
pushq $0x2f
popq %rsi
movq %r14, %rdi
callq 0x3130
movq %rax, %r14
movq %rax, 0xd10(%rbx)
testq %r14, %r14
je 0x4574
cmpb $0x2f, (%r14)
jne 0x4574
movq %r14, %rdi
callq 0x3160
cmpq $0x1, %rax
jne 0x4634
movq %r14, %rdi
callq 0x3160
movabsq $0x74682e656764756a, %rcx # imm = 0x74682E656764756A
movq %rcx, (%r14,%rax)
movl $0x6c6d74, 0x7(%r14,%rax) # imm = 0x6C6D74
movl $0x1, 0xc40(%rbx)
xorl %ebp, %ebp
jmp 0x4574
nop