Status code and content come altogether

I think the sentence below in this paragraph is a little misleading.

If the server approves the client’s request, the server sends the client a “200 OK” message, which means “Of course you can look at that website! Here it is”, and then starts sending the website’s files to the browser as a series of small chunks called data packets

This “then” implies that they are two separated responses which I think is not correct. HTTP works in layer seven of OSI model, This means all TCP packets have to be received and reassembled by the client, then http packet (or more specifically status_code) gets it’s own meaning.

What I was trying to say is the http content and the http status code come altogether not status code comes first then content.

Am I right ?

Hello @soroushbakhtiary

english is not my first language so can not be sure what is better but the server can send the response in multi chunk so maybe that what they meant by then as it not always small data to be in one single response

i could be wrong also and have a nice day :slight_smile:


Thank for reply. :slightly_smiling_face:
Of course if the content that server wants to send is bigger than TCP packet size, it will split the packet into several chunks and sends them but they are all in layer 4.

I think because browser works in layer 7 (application layer), it can not understand the single TCP chunk, they have to be reassembled to make actual “HTTP Packet” which contains Header and content etc…

you welcome @soroushbakhtiary

not sure if i got your point

but try the following case

go to youtube and pick a very long video you will notice that it still load while you watching it same thing for live stream service
it’s not always about tcp packet size

let me ask @jwhitlock to give his thought on that

and have a nice day both of you :slight_smile:

1 Like

Thanks for reaching out. I was an MDN developer, but I think the opinions of the writers are more accurate here. This document is focused on learners, and it takes skill and empathy to write for that audience. I’m pretty far along in my developer journey (I’m likely to go to Wikipedia or read the RFC directly), and I don’t trust my instincts for learner-level documentation.

But, you asked for my opinion…

My opinion is that the paragraph is OK (200 OK even :wink:), and it is close enough to how things actually work. Yes, in most cases, the HTML is in that initial request as well, probably spread over some TCP/IP packets. However, the information on this page, plus that in the following paragraphs (talking about requests for follow-on resources like CSS and JS) is enough for someone new to this information, and will give them the mental framework to start using developer tools and dig in further. The developer tools should be the learner’s next step, not network theory.

I think talking about the OSI model will be confusing at this stage. I think the OSI model is most appropriate if you need to work lower in the stack, such as setting up firewall rules, or are transferring knowledge about one protocol to another, such as learning HTTP 1.0 vs 1.1 vs HTTP2. I don’t think it adds much, other than confusion, at this stage of the learner’s development.

@soroushbakhtiary you are correct that the HTTP message usually includes the status line, other HTTP headers, and then the content, all in one message. There are exceptions - if you or the browser makes a HEAD request, the server is expected to only return the status line and headers. And, if the message is big enough, like a video stream, the server may require serving via byte ranges, so multiple HTTP requests are needed to fetch all the content. But I’d expect all of the HTML content returned in the first request for 99% of websites. HTTP/2 had a feature where you could also push some of the JS and CSS in that initial response payload, but I think that proved too tricky to implement for most web servers.

When you are ready to directly talk to the MDN content team, see the repository. There are some contribution guidelines, as well as a few ways to contribute. This question could be an issue in that issue tracker, or you may feel confident enough to jump to a pull request against the page content.


@jwhitlock Thanks, I really appreciate for your invaluable information.

thanks a lot @jwhitlock for the details :slight_smile: