1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What can be the most appropriate answer for this HTTP Problem

Tags:
  1. Nov 23, 2014 #1
    1. The problem statement, all variables and given/known data
    A graphical HTML browser resident at a network client machine Q accesses a static HTML
    webpage from a HTTP server S. The static HTML page has exactly one static embedded image
    which is also at S. Assuming no caching, which one of the following is correct about the HTML
    webpage loading (including the embedded image)?

    (A) Q needs to send at least 2 HTTP requests to S, each necessarily in a separate TCP connection to server S
    (B) Q needs to send at least 2 HTTP requests to S, but a single TCP connection to server S is sufficient
    (C) A single HTTP request from Q to S is sufficient, and a single TCP connection between Q and S is necessary for this
    (D) A single HTTP request from Q to S is sufficient, and this is possible without any TCP connection between Q and S

    2. Relevant equations


    3. The attempt at a solution
    I think only 1 http request and 1 tcp connection is enough. First Q sends an http request to H, then a tcp connection will be established between Q and H. Then H will send an http response having static HTML webpage to Q. Hence (C)
     
  2. jcsd
  3. Nov 23, 2014 #2

    jedishrfu

    Staff: Mentor

    your client browser having processed the html for display must still request the image too right?
     
  4. Nov 23, 2014 #3

    Mark44

    Staff: Mentor

    Since the image is embedded in the html page, my thought (which very well could be wrong) is that a single GET request would suffice without a TCP connection being needed. The payload of the GET request could be broken up into multi-part MIME to represent the text content of the HTML page and the binary portion that is the image.
     
  5. Nov 23, 2014 #4

    DaveC426913

    User Avatar
    Gold Member

    If you're using a browser such as Chrome, you could open the Dev window right now and watch it make the image requests.
     
  6. Nov 23, 2014 #5

    Mark44

    Staff: Mentor

    Chrome, Firefox, IE and possibly other browsers have debugging windows, available by pressing F12. One of the options is to view network traffic, such as HTTP requests and responses.
     
  7. Nov 24, 2014 #6

    jtbell

    User Avatar

    Staff: Mentor

    Another way to study this is to install and run a local web server on your own computer. Many people do this under Windows using a WAMP (Windows, Apache, MySQL, PHP) package, or (like me) under Mac OS using a MAMP package. Then you can code a simple test page, call it up in your browser using an address like http://localhost/yourpage.html [Broken], and examine the server log file to see exactly which requests it received.
     
    Last edited by a moderator: May 7, 2017
  8. Nov 24, 2014 #7

    jedishrfu

    Staff: Mentor

    or you could use node.js to deliver your web page but I think building a web server is overkill for this question. As others have pointed out the debugger feature of most browsers would be sufficient.
     
  9. Nov 24, 2014 #8

    jedishrfu

    Staff: Mentor

    with respect to the static embedded image I thought it meant that an img tag was used to reference an image as is commonly done.

    However, there is a technique to truly embed an image in a webpage using the image tag as a coded base64 hexadecimal string eliminating the request for the image.

    The caveat is that people use this trick for small icon images as larger images will make the web page much larger making a request take far longer to download than if you simply downloaded the image in binary. Recall that base64 hexadecimal will use two bytes to represent one binary byte.
     
  10. Nov 24, 2014 #9

    Mark44

    Staff: Mentor

    This is what I had in mind as being an embedded image.
     
  11. Dec 8, 2014 #10
    Hello jedishrfu, I used Fiddler and it clear my concept. 2 HTTP request and 1 TCP connection will be needed.
    One more thing, I want to ask. As Browser sends http request for a webpage, It gets html code in response. It then parse the code and again by default send the http request for the images. But at the same time for some hyperlinks it waits for the client to click on it. For what sort of files browser by default sends http request and for what it does'nt.
     
    Last edited: Dec 8, 2014
  12. Dec 8, 2014 #11

    jedishrfu

    Staff: Mentor

    If the html uses the link tag then the web browser will wait until you click on the link. There may be other instances of where things aren't download too.

    One, I can think of is javascript code connected to a button or mouse over event that once activated then a request is sent. Another is when a delay timer expires and some javascript code then sends a request. These tricks are often used to bypass web browser protections about opening excessive windows which drive endusers crazy...

    http://www.w3schools.com/tags/tag_link.asp

    Here's something of interest on Responsive Web Design which talks very briefly about the link tag:

    http://en.wikipedia.org/wiki/Responsive_web_design
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: What can be the most appropriate answer for this HTTP Problem
Loading...