Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8781687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:22:09+00:00 2026-06-13T20:22:09+00:00

HTTP/1.1 200 OK Content-Type:text/html <html><body><img src=\http://localhost:5000/twitter.png\ alt=\Smiley face\ height=\256\ width=\256\/></body></html> Here in this http

  • 0
HTTP/1.1 200 OK
Content-Type:text/html

<html><body><img src=\"http://localhost:5000/twitter.png\" alt=\"Smiley face\" height=\"256\" width=\"256\"/></body></html>

Here in this http response example if I change

Content-Type:image/*

Everything else is just the same. Then what kind of difference does it make ?
When I tested with my simple test web server which I wrote:

In the first case – the exact html was being received by the browser, but the image was not getting displayed. A small image with a triangle, circle embedded in a rectangle was coming.

In the second case with content-type: image/*
the image requested was getting downloaded but image could not be opened.

For example if

Content-Type = image/png

the image was not getting downloaded but html perceived by browser was getting changed like

 <html>
 <body style="margin: 0px;">
 <img style="-web-user-select: none" src="http://localhost:5000"/>
 </body>
 </html>

My question is how to use these content types?


Http Response:

 HTTP/1.1 200 OK
 Content-Type:image/png
 Content-Lenth:27892
 Server:Learnee

 \211PNG

g9\357ax\257a>\307\365\333\324\3658\313
\234H\245\374\215\321\371\373\317\302Rh \364\263K\353\273\362\312+\243\200\\321\376\217\337\360u)\373X\355q*1\267\235\342;I\316\341\265\310\317I:q\332\325\317{0\245T\334^WH#l  s\200\231\2422\252q>;\346\312d\252X\201\365\312\304%:\216H\316\306\372{\323axDB\215\3178Y\345\254*\245\366R\357a\235    җ\2148\252D\236S\232\231\370z\342w\337\375V\265Z\315c/:,d\311<շ\367D1\356\337\326֖\373\242\263t\351\325\377IRmo\264R\376S\200\352_\276\242K7\214\263\333{\230\267횥\313qc\317\347S\3022<ه\202\273ڟ\203l\310\344\216\356M\322Я\225\240\300=N1\277\271\355\327ߺtv̀ٙ\231\231\374\226-[\204~\265U\341\220OO\344\211q\316\257\246\276\345&\354\352\227\325!\274<\264\233\234\352p\263\301\3237\275\334و\203]\2712\371\332\306I\222\207\233\341獶\215\257&7Y7 K\302u@\373\235\370   0\275\373ؾ$\235B$z?\200zD\343yǯܓ\356\241BW\327\320m\214\337\301f\327@\300a\201\262C\257\244\216p\366\330\220\325\301@\215\332G/-\320Ԃ\267\246X%\344ȔD\216N{\277Q\277\3361M\276\264~/i\213\3529D\320@`\307\314N@=\334\316\200\272\300)\367}?<L\233D\372\227\275-[$\375\330.\222\257T\351\313em\377\263q]:\307@p%Xӭ\204\222\365>8K\266ga\200@
H3\352Z3\200R\320\347SU\301
G>\323!\307tD\200\205{~\370\3524\371鶌>S\220\263D5\224(@\214SN\221{\264L@f\216%\247\200  \360\3455\376Y`\341s\263U2YR\214p\363\320pA[?\237A\270@\357\214\221\273x!\240*\327o\231"\367\215\314\325&E\321Su \220)\200\243\261\363@\200\335a\265\337.\242~Y\300\242d\214f\232\262\231\275E\370㣫W\257\216%\223\3114(~
+=\261\347EP|\264\377G\200L\213řB\241\220۴iS\371\251\247\236r\360OD\231\371G\376a\354tt
\364~6\217\3471\364'

Code for fetching data from file:

bool ServerFileSystem::getDataFromFile(std::string urlPath, std::string& chunkData)
{
std::stringstream stream;
std::cout << urlPath << std::endl;

if(!strcmp(urlPath.c_str(), "/"))
{
    urlPath = urlPath + "index.html";
    std::cout << "URL Path: " << urlPath;
}

std::string localPath = SERVER_ROOT + urlPath;
std::ifstream file(localPath.c_str());

file.seekg(0, std::ifstream::beg);

while(file.tellg() != -1)
{
    char *p = new char[1024];

    bzero(p, 1024);
    file.read(p, 1024);

    stream << p;
    stream.flush();

    delete p;
}

chunkData = stream.str();

file.close();

return true;
} 

I am getting the whole data in the form of string and appending headers necessary. So, the final response which I am sending is the one shown above the code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:22:10+00:00Added an answer on June 13, 2026 at 8:22 pm
    HTTP/1.1 200 OK
    Content-Type:text/html
    
    <html>[...]</html>
    

    If I change [the Content-Type-header] to Content-Type:image/*, everything else is just the same. Then what kind of difference does it make ?

    You’re in luck: your browser adheres to the robustness principle. It could say: "I don’t know what you’re trying to do, but I’m not going to render HTML as an image. I think I’ll just issue a "Cannot display page" error".

    Instead it goes: "Wait, the content does look like HTML, why not give it a try?".

    You will want to serve your HTML as such, and the same goes for images: serve them with the appropriate image MIME type.

    See also:

    RFC 2045, section 5:

    The purpose of the Content-Type field is to describe the data
    contained in the body fully enough that the receiving user agent can
    pick an appropriate agent or mechanism to present the data to the
    user
    , or otherwise deal with the data in an appropriate manner. The
    value in this field is called a media type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is the following allowed according to the SOAP spec? HTTP/1.1 200 OK Content-Type: text/xml;
app=function(req,res) { res.writeHead(200,{'Content-Type':'text/plain'}) var buffer=new Buffer(100) var fs=require('fs') fs.open('.'+req.url,'r',function(err,fd){ fs.fstat(fd,function(err, stats){ var i=0 var
I need help in parsing big Json file: {status:{code:200,text:OK},content:[{proposalId:12536,providerId:1,supervisorName:null,supervisorEmail:lolbroek_13@hotmail.com,hostInstitution:qsd,hostCountry:qsd,hostCity:QSD,hostTypeId:1,title:qsd,status:available,numberStudents:null,description:qsd,categoryId:34,startDate:null,endDate:null,submitDate:null,expectedWorkload:null,purpose:null,workOrganisationId:1,function:null,audienceId:1,preConditions:,certificationGranted:null,deliverables:null,expenses:null,revenue:null,vacancies:null,uploadImg:http:\/\/193.136.60.238\/\/MUTW2012\/core\/img\/internship.png}, {proposalId:12537,providerId:1,supervisorName:null,supervisorEmail:lolbroek_13@hotmail.com,hostInstitution:qsd,hostCountry:qsd,hostCity:QSD,hostTypeId:1,title:qsd,status:available,numberStudents:null,description:qsd,categoryId:34,startDate:null,endDate:null,submitDate:null,expectedWorkload:null,purpose:null,workOrganisationId:1,function:null,audienceId:1,preConditions:,certificationGranted:null,deliverables:null,expenses:null,revenue:null,vacancies:null,uploadImg:http:\/\/193.136.60.238\/\/MUTW2012\/core\/img\/internship.png}, {proposalId:12538,providerId:1,supervisorName:null,supervisorEmail:lolbroek_13@hotmail.com,hostInstitution:qsd,hostCountry:qsd,hostCity:QSD,hostTypeId:1,title:qsd,status:available,numberStudents:null,description:qsd,categoryId:34,startDate:null,endDate:null,submitDate:null,expectedWorkload:null,purpose:null,workOrganisationId:1,function:null,audienceId:1,preConditions:,certificationGranted:null,deliverables:null,expenses:null,revenue:null,vacancies:null,uploadImg:http:\/\/193.136.60.238\/\/MUTW2012\/core\/img\/internship.png}, {proposalId:12539,providerId:1,supervisorName:null,supervisorEmail:lolbroek_13@hotmail.com,hostInstitution:qsd,hostCountry:qsd,hostCity:QSD,hostTypeId:1,title:qsd,status:available,numberStudents:null,description:qsd,categoryId:34,startDate:null,endDate:null,submitDate:null,expectedWorkload:null,purpose:null,workOrganisationId:1,function:null,audienceId:1,preConditions:,certificationGranted:null,deliverables:null,expenses:null,revenue:null,vacancies:null,uploadImg:http:\/\/193.136.60.238\/\/MUTW2012\/core\/img\/internship.png}, ................[etc] I
I have issue with sending AJAX body request using jQuery CORS with custom Content-type.
Here is my code <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title></title> <script type=text/javascript src=<%= ResolveUrl(Scripts/jquery-1.3.2.min.js) %>></script>
I have a problem. Client side code <html> <body onload=fun()> <script src=C:\cygwin\usr\local\lib\node\.npm\socket.io\0.6.16\package\support\socket.io-client\socket.io.js></script> <script> function
Given the service: > GET /hotel < HTTP/1.1 200 OK < <hotel> < <a>aaa</a>
I want to click the video on this page http://37.128.191.200/?640 using JavaScript but can't
I have the following result from geoPlugin http://www.geoplugin.net/json.gp?ip=64.90.182.55 : geoPlugin({ geoplugin_request:64.90.182.55, geoplugin_status:200, geoplugin_city:New York,
I have WSGI middleware that needs to capture the HTTP status (e.g. 200 OK

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.