So the Mongoose.c library is pretty straight-forward. I've been able to use their event system, URL recognition, multi-form example, and their connection system to build a simple login-system. I've used C++ minGW, the mongoose.c&.h, and my browser. Now I'd like to implement images.
But there's a fundamental issue I can't get around. I can transfer EITHER an html document, OR an image. The jpg, alone, will display happily, as will the html document, so long as either is alone. My code is relatively simple, for html:
--pretend std::string HTMLAsString holds all html for the document.
mg_send_data(conn,HTMLAsString,strlen(HTMLAsString));
When I want to send an image, its quite similar:
while ((fread(buf, 1, sizeof(buf), fp)) > 0) {
mg_send_data(conn,buf,n);
}
mg_send_data(conn,"\r\n",2);
Both of these work (I've cut out the irrelevant parts like how the string is composed, or how the buffer is filled, suffice to say those aspects work). I can have HTML formatting, with a 'missing image space,' or I can have an image shown, but no HTML.
How do I send BOTH an image and HTML?