diff options
author | fxqnlr <[email protected]> | 2024-09-20 10:51:45 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2024-09-20 10:51:45 +0200 |
commit | 0b7957db671400ee34f8f597b409f792e5300186 (patch) | |
tree | 8d0375b54a861b6de54c69a34fdd68d20e959d76 /main.asm | |
parent | 9c5783f030d7c876ccf6e05e8182d88f84a97fc3 (diff) | |
download | asmsite-0b7957db671400ee34f8f597b409f792e5300186.tar asmsite-0b7957db671400ee34f8f597b409f792e5300186.tar.gz asmsite-0b7957db671400ee34f8f597b409f792e5300186.zip |
Diffstat (limited to 'main.asm')
-rw-r--r-- | main.asm | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -12,9 +12,10 @@ struc db [data] | |||
12 | segment writable readable | 12 | segment writable readable |
13 | connect_header db 'HTTP/1.1 200 OK', 13, 10 | 13 | connect_header db 'HTTP/1.1 200 OK', 13, 10 |
14 | db 'Content-Type: text/html', 13, 10 | 14 | db 'Content-Type: text/html', 13, 10 |
15 | db 'Server: asmsite', 13, 10 | ||
15 | db 'Connection: close', 13, 10 | 16 | db 'Connection: close', 13, 10 |
16 | db 13, 10 | 17 | db 13, 10 |
17 | db '<!DOCTYPE html><html><head><title>asmsite</title></head><body>Hello, World!</body></html>', 10 | 18 | db '<!DOCTYPE html><html><head><title>asmsite</title></head><body>Hello, World!</body></html>', 10 |
18 | connect_header_len = $ - connect_header | 19 | connect_header_len = $ - connect_header |
19 | 20 | ||
20 | stat_msg db 'Get file stats', 10 | 21 | stat_msg db 'Get file stats', 10 |
@@ -50,6 +51,13 @@ serveraddr_len = $ - serveraddr.sin_family | |||
50 | clientaddr servaddr_in | 51 | clientaddr servaddr_in |
51 | clientaddr_len dd serveraddr_len | 52 | clientaddr_len dd serveraddr_len |
52 | 53 | ||
54 | struc timespec | ||
55 | { | ||
56 | .time dq 0 | ||
57 | .time_nano dd 0 | ||
58 | } | ||
59 | sleep_time timespec | ||
60 | |||
53 | segment readable executable | 61 | segment readable executable |
54 | 62 | ||
55 | entry _main | 63 | entry _main |
@@ -92,7 +100,7 @@ _main: | |||
92 | jl error | 100 | jl error |
93 | 101 | ||
94 | ls_write STDOUT, listen_msg, listen_msg.size | 102 | ls_write STDOUT, listen_msg, listen_msg.size |
95 | ls_listen qword [socketfd], 5 | 103 | ls_listen qword [socketfd], 4096 |
96 | cmp rax, 0 | 104 | cmp rax, 0 |
97 | jl error | 105 | jl error |
98 | 106 | ||
@@ -106,6 +114,10 @@ listen: | |||
106 | 114 | ||
107 | ls_write qword [connfd], connect_header, connect_header_len | 115 | ls_write qword [connfd], connect_header, connect_header_len |
108 | 116 | ||
117 | ;; mov [sleep_time.time], 10 | ||
118 | ;; mov [sleep_time.time_nano], 1000 | ||
119 | ;; ls_nanosleep sleep_time.time, 0 | ||
120 | |||
109 | ls_close qword [connfd] | 121 | ls_close qword [connfd] |
110 | 122 | ||
111 | jmp listen | 123 | jmp listen |