Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

website broken, terminal broken cause &(body[0]) si body.empty() #36

Open
jerperez42 opened this issue Oct 10, 2024 · 0 comments
Open

Comments

@jerperez42
Copy link
Collaborator

Le STDOUT casse a parti de la ligne server/pollin.cpp:86

std::cout << "body is " << &(body[0]) << std::endl;

En effet afficher body.size() = 0. Donc on lit de la memoire au pif car body[0] est indetermine.

Le control C / ne marchent plus pour cause de magie de memoire mal geree.

Le programme coutinue de tourner et valgrind affiche parfois un invalid read (sorcelerie)

==1106316== Invalid read of size 1
==1106316== at 0x427ACA: Server::chunked_post(int, std::vector<unsigned char, std::allocator >, s_header_infos&) (chunk_receive.cpp:81)
==1106316== by 0x434137: Server::receive_data(int, int) (pollin.cpp:59)
==1106316== by 0x436458: Server::ServerRun() (ServerRun.cpp:111)
==1106316== by 0x437C91: Server::ServerStart() (ServerStart.cpp:130)
==1106316== by 0x406A4F: main (main.cpp:76)
==1106316== Address 0x55bfbac is 220 bytes inside a block of size 352 free'd
==1106316== at 0x484B8AF: operator delete(void*) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1106316== by 0x424A2C: std::__new_allocator<std::_Rb_tree_node<std::pair<int const, s_header_infos> > >::deallocate(std::_Rb_tree_node<std::pair<int const, s_header_infos> >*, unsigned long) (new_allocator.h:158)

Des message sont parfois affiches (malgres le STDOUT qui marche plus, heresie):
`error code :: No such file or directory'

Fermer la page/navigateur debloque le control + C et s'affiche:

`body is'

Bien sur je sais pas pourquoi body est vide. Mais c'est une autre histoire.

Teste avec https://github.com/alessandraburckhalter/90s-Website.git
conf:

server {
listen 127.0.0.1:8080;
root ./90s;
client_max_body_size 165682;
index index.html;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant