Skip to content

Commit

Permalink
Adds GET and POST support
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie Xiao committed Oct 14, 2024
1 parent 2690921 commit 2087412
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions server.s
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ child_loop:
=========RSP=========
[rsp] Buffer: Temporary buffer to store the HTTP request line (size: REQUEST_LINE_SIZE = 0x300)
[rbp-0x18] int:File descriptor
[rbp-0x10] char*:Start of get path
[rbp-0x10] char*:Start of request path
[rbp-0x8] u64: @rdi
=========RBP=========
*/
Expand All @@ -106,11 +106,21 @@ read_request:
call strchr
mov BYTE PTR [rax], 0 # Null out string

lea rdi, [rip + POST_STRING]
lea rsi, [rsp]
call strcmp
mov rdi, [rbp-8]
lea rsi, [rsp]
mov rdx, [rbp-0x10]
call handle_POST_request

cmp rax, 0
je POST
call handle_GET_request
leave
ret

POST:
call handle_POST_request
leave
ret

Expand Down Expand Up @@ -166,7 +176,6 @@ POST_data_found:
mov rdi, rsi
call strlen


mov rdx, rax # count of bytes
mov rax, SYS_write # write into the file
mov rdi, [rbp-0x20] # file descriptor
Expand Down

0 comments on commit 2087412

Please sign in to comment.