0

In HTTP 1.0 I know that a new socket connection is made as soon as the browser sends a new GET request. I was wondering if the browser sends the GET request for each individual file in the website. For example, let's say we have a static website with 3 image files and the index.html file. When we connect to the server, does the browser send 4 separate requests (aka 4 different connections), or does it only connect to the website once and retrieve all the content (aka only 1 connection is enough)?

comsfollower
  • 35
  • 13

2 Answers2

1

If you open the developer console in a browser and look at Network (in Chrome) it shows you all of the requests that are made. It will make an individual request for each resource. Also, if an image is used 20 times it will be requested once and displayed 20 times. Although all of these requests are made separately it could still be that they are all done through the same connection as a request and a connection are not the same thing. Hope this gives you a bit of direction. These two links may give you a bit more information on connections to the server.

https://en.wikipedia.org/wiki/HTTP_persistent_connection https://en.wikipedia.org/wiki/HTTP_pipelining

Dhunt
  • 1,584
  • 9
  • 22
  • Thanks, I actually meant connections. Sorry for the confusion. So will we have 4 separate connections for the example I gave above? – comsfollower Nov 17 '15 at 08:16
  • Its likely that 4 requests are made with 1 connection. Assuming the resources are all coming from the same server. – Dhunt Nov 17 '15 at 08:20
1

As explained in this answer (regarding HTTP 1.0 vs 1.1), in v1.0 every request is sent in a separate connection, so that would be 4, however, due to caching mechanisms (which are available in v1.0), the browser might not send any request at all, and hence not open any connection.

Community
  • 1
  • 1
Amit
  • 45,440
  • 9
  • 78
  • 110