RanniSch / webserv

0 stars 2 forks source link

Configuration: Setup multiple servers with different ports. #71

Closed MaxIhme closed 10 months ago

MaxIhme commented 10 months ago

EDIT: No Problem anymore

config: server { listen 8000 8080 8010; ... } server { listen 8090 ; .... }

open http://localhost:8000/ -> works fine open http://localhost:8090/ -> throws either bad alloc or segfault: (I tested several times, and it seems to work with different servers with different ports, the errors happen occasionally)

"HEADER: GET / HTTP/1.1 Host: localhost:8090 Connection: keep-alive sec-ch-ua: "Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Accept-Encoding: gzip, deflate, br Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7 NOTHING 0 ACCEPT CONNECTION => 8DONE

WRITING back to the socket: 9 fd: 9 error:0 WE HAVE FINISHED WRITING TO THE BROWSER Client Socket: 9 was closed successfuly File deleted successfully: tmp/tmp_file_9 make: *** [Makefile:85: e] Segmentation fault ➜ simplified-serv git:(main) ✗ "

and another time this message comes:

"WRITING back to the socket: 10 fd: 10 error:0 WRITING back to the socket: 10 fd: 10 error:0 WE HAVE FINISHED WRITING TO THE BROWSER Client Socket: 10 was closed successfuly File deleted successfully: tmp/tmp_file_10 ACCEPT CONNECTION => 8DONE

ACCEPT CONNECTION => 6DONE

terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc make: *** [Makefile:85: e] Aborted ➜ simplified-serv git:(test_dienstag) ✗ "

RanniSch commented 10 months ago

For me 2 from 3 ports work and when I try to enter the third port in the browser I get a seg fault. No matter which Port I wanna use third, the server Seg faults.

image

RanniSch commented 10 months ago

How did you test it at MaxIhme?

I get no segfault, but an Error Code.

MaxIhme commented 10 months ago

for me all ports work now.

config: server { listen 8000 8080 8010; ... } server { listen 8090; autoindex on; allowed_Methods GET; ... }

put in browser: localhost:8000 then localhost:8080 then 8010 then 8090

MaxIhme commented 10 months ago

test again @RanniSch @LukasKava

RanniSch commented 10 months ago

works