#C socket programming issue with image rendering

7 messages · Page 1 of 1 (latest)

nocturne saffron
#

Hey guy's,

I've been learning on c and trying to implement a HTTP server in C and i have issues with rendering an image in web browser so every time i try to access the image via server i get ` the image cannot be displayed because it contains an error'

What am i doing wrong?

here is my code
main.c https://pastebin.com/pHvcMW4p
filehandle.c https://pastebin.com/GSguS42W

stiff oxideBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

glacial sandal
#

I believe line 126 in main.c? again not too familiar

plucky sigil
#

From a short test run I can confirm that as james said, the problem is at main.c:126, specifically at the end of the format string you need an extra CRLF (\r\n) to separate the HTTP headers from the message body (see the BNF grammar in https://www.rfc-editor.org/rfc/rfc2616#section-4.1)

nocturne saffron
#

thank you

#

!solved