-
Tiny serverλ μ μ , λμ μ½ν μΈ λ₯Ό μ 곡νλ μμ μΉμλ²μ΄λ€.
-
Tinyλ GET λ©μλλ§ μ§μνλ€.
-
argc β 2
λΌλ μλ―Έλ μ°κ²°λ ν¬νΈκ° μλ€λ κ²μ μλ―Ένλ€. argcλ argvμ κ°μμ΄λ€. -
κ·ΈλΌ μ 1κ°λ§ μμ΄λ λλκ² μλλλΌκ³ μκ°ν μ μλλ°, μκΈ° μμ μ κ°λ¦¬ν€λ μ£Όμκ°μ΄ μκΈ° λλ¬Έμ μκΈ° μμ μ ν¬ν¨νκ³ 2κ°κ° μμ΄μΌ μ°κ²°ν ν¬νΈκ° μλ€λ κ²μ μλ―Ένλ€.
-
open_listenfd
λ₯Ό ν΅ν΄server_socket
μlisten
κΉμ§ νΈμΆλlistening socket
μ΄ μμ±λλ€. -
connfd
λ μ°κ²°μ© μμΌμ΄λ€.client
λ‘λΆν° (clientaddr
)listenfd
κ° μ°κ²°μμ²μ λ°μλ€μΌ λ ν΄λΉ μμΌμ μμ±νμ¬client
λ‘λΆν° μ°κ²°μμ²μ λ°μλ€μΈλ€.
π Using Functions
void doit(int fd);
void read_requesthdrs(rio_t *rp);
int parse_uri(char *uri, char *filename, char *cgiargs);
void serve_static(int fd, char *filename, int filesize, char *method);
void get_filetype(char *filename, char *filetype);
void serve_dynamic(int fd, char *filename, char *cgiargs, char *method);
void clienterror(int fd, char *cause, char *errnum, char *shortmsg,
char *longmsg);
- ν κ°μ ν΄λΌμ΄μΈνΈ μμ²λ§ μ²λ¦¬νλ μλ²λ₯Ό μ μ νμ§ λͺ»νλ€.
- λ€μμ λ€νΈμν¬ ν΄λΌμ΄μΈνΈμκ² μλΉμ€λ₯Ό μννκΈ° μν΄μλ λμμ± μλ²λ₯Ό μμ±νμ¬ ν΄λΌμ΄μΈνΈμκ² λ³λμ μλΉμ€λ₯Ό μ 곡νλ λ°©μμ΄ νμνλ€.
- ꡬνμ Threadλ₯Ό μ¬μ©ν λμμ± μλ²λ₯Ό ꡬννμλ€.
- μλ‘κ² μμ±ν νΌμ΄μ°λ λ
tid
κ° μ°κ²°μλ³μ ν¬μΈν°*commfdp
λ₯Ό μμ°Έμ‘°νλ κ² >>Pthread_create
- μ°λ λλ₯Ό λΆλ¦¬νλ μ΄μ : λΆλ¦¬λ μ°λ λμ νΉμ§ λλ¬Έ >>
λ€λ₯Έ μ°λ λμ μν΄ μ²μλκ±°λ μ’ λ£λμ§ μκ³ ν΄λΉ μ°λ λκ° μ’ λ£λλ©΄ μλμΌλ‘ λ©λͺ¨λ¦¬ μμμ λ°ν
- μλ²μμ μ°κ²° μμ²μ μμ ν λλ§λ€ μλ‘μ΄ νΌμ΄μ°λ λκ° μμ±λ μ μλ€. μ΄λ κ°κ°μ μ°κ²°μ΄ μ°λ λ λ³λ‘ λ 립μ μΌλ‘ μ²λ¦¬λλ―λ‘ κ°κ°μ νΌμ΄ μ°λ λκ° μ’ λ£λκΈ°λ₯Ό κΈ°λ€λ¦΄ νμμμ΄ μ’ λ£λμλ§μ λ©λͺ¨λ¦¬μμμ λ°ννλ λ°©μμ΄ μ μ νλ€.
####################################################################
####################################################################
This directory contains the files you will need for the CS:APP Proxy Lab.
proxy.c csapp.h csapp.c These are starter files. csapp.c and csapp.h are described in your textbook.
You may make any changes you like to these files. And you may
create and handin any additional files you like.
Please use `port-for-user.pl' or 'free-port.sh' to generate
unique ports for your proxy or tiny server.
Makefile This is the makefile that builds the proxy program. Type "make" to build your solution, or "make clean" followed by "make" for a fresh build.
Type "make handin" to create the tarfile that you will be handing
in. You can modify it any way you like. Your instructor will use your
Makefile to build your proxy from source.
port-for-user.pl Generates a random port for a particular user usage: ./port-for-user.pl
free-port.sh Handy script that identifies an unused TCP port that you can use for your proxy or tiny. usage: ./free-port.sh
driver.sh
The autograder for Basic, Concurrency, and Cache.
usage: ./driver.sh
nop-server.py helper for the autograder.
tiny Tiny Web server from the CS:APP text