jun-wiki

View My GitHub Profile

Posts (Latest 10 updated) :
Read all
Contents:
  1. 과제하기
    1. cgi adder 구현
    2. 11.6.c

오늘 TIL


새벽 2시에 추가하는 TIL-DLC이다

YIL이라 부르는게 더 나을 판이지만

그래도 TIL은 TIL이다

새벽에 뻘글이 아닌 공부글 쓰려니 우울하다… emoji


과제하기

과제 말고 제과하고 시퓨퓨ㅠㅠ

WAN_LAN


cgi adder 구현

첫번째 과제다

cgi adder가 뭔지부터 보자

걍 동적 콘텐츠 예제로 숫자 두개 주면 더해서 돌려주는 거 만들면 된다고 한다

?

벌써 클리어 해버렸다…

이미 cgi-bin 폴더에 adder.c 파일이 들어있었으니…

시작과 동시에 첫번째 과제…

클리어!!!!

특이하게도 입력창에 값 입력하면 결과값이 출력되는게 아닌

주소창으로 값 입력을 조작한다

7 + 5를 하고 싶으면
http://localhost:8080/cgi-bin/adder?arg1=7&arg2=5

9 + 14를 하고 싶으면
http://localhost:8080/cgi-bin/adder?arg1=9&arg2=14

이런식으로 말이다
URL의 /adder? 뒤의 arg1, arg2에 값을 입력하는 식이다


11.6.c

첫 과제로 csapp의 11.6.c다

Tiny 출력 조사해 사용 브라우저 HTTP 버전 알아오면 되는 간단한 과제다

Accepted connection from (localhost, 58906)
Request headers:
GET /godzilla.gif HTTP/1.1
Connection: keep-alive
sec-ch-ua-platform: "Windows"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
sec-ch-ua: "Not;A=Brand";v="99", "Google Chrome";v="139", "Chromium";v="139"
sec-ch-ua-mobile: ?0
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: image
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7

Response headers:
HTTP/1.0 200 OK
Server: Tiny Web Server
Connection: close
Content-length: 12155
Content-type: image/gif

Accepted connection from (localhost, 45186)

Request를 보면 알 수 있듯이

HTTP1.1이라는 걸 알 수 있다

두번째 과제 클리어

이-지 하다



밤이 깊었으니 여기까지