RanniSch / webserv

0 stars 2 forks source link

Basic checks: UNKNOWN requests should not result in a crash. #41

Closed MaxIhme closed 1 year ago

MaxIhme commented 1 year ago

PUT request with postman to 127.0.0.1:8000/ -> browser hangs and terminal is full of: FILE WAS NOT BEEN OPEN! (tmp folder exists)

restart try again, same. restart try again, same. restart try again, same. -> seems to be consistent when I click on Cancel in postman, new printing of FILE WAS NOT BEEN OPEN! stops and after some time comes: "ERROR: recv has failed! CHECK RECV ERROR: : Connection reset by peer"

i tryed with PATCH request, same behaviour

UPDATE 31.10: with docker I get 501 on mac I get 501 (not implemented) (correct) could you both test it @RanniSch @LukasKava

Ranja: For me it throws 404 error in postman, but no hanging. In Browser it redirects to the index.html, but no hanging.

MaxIhme commented 1 year ago

debug shows: Bildschirmfoto 2023-10-27 um 16 51 08

MaxIhme commented 1 year ago

@LukasKava for another request method it does not socket.setResponseFile(filename); because it does not go to: int TestServer::_saveResponseToAFile (checked every occurence of the function) because returns -1 -> RequestMethod is "NOTHING" int TestServer::_readAndParseHeader(Socket &socket, std::string strBuffer) { std::cout << YELL << "READING AND PARSING! [" << socket.getRequestMethod() << "]" << BLANK << std::endl; if (socket.getRequestMethod() == "NOTHING") { if (_checkForMethods(socket, strBuffer) == -1) return -1; }

int TestServer::_checkForMethods -> recognizes wrong method but no adequate Error handling

Bildschirmfoto 2023-10-27 um 17 16 10

MaxIhme commented 1 year ago

inbetween comes: "Listening Socket onject for Port: 8090fd: 5 succesfully created! ERROR: poll() has timed out: : Bad address ACCEPT CONNECTION => 3DONE

READING AND PARSING! [NOTHING] TMP_METHOD: [POST] CHOSEN METHOD: [POST] ERROR: Impossible to retrieve Content len from POST request ERROR withing _readAndParseHeader"

LukasKava commented 1 year ago

@MaxIhme I tested No segfaults or hangs but I test with curl and not POSTMAN please retest it with POSTMAN but I think it should work there too if it wont just write to me immediatelly

RanniSch commented 1 year ago

Works now for me