|Subject:||Re: Browser image requests - no path Info in GET|
|Posted by:||tony meadors (tonymeado…@adelphia.net)|
|Date:||Fri, 29 Sep 2006|
Thank you for your detailed explanation.
I hope I am not as muddled as you have gathered from
my short problem description.
I do know what a URL is and that it the responsibility of the
server to take into account the root dir in interpreting requests.
Naturally, the browser doesn't ever have system path knowledge...
You restated my problem beautifly with:
" the browser is trying to load the image from the same URL
folder that the HTML file was requested from. "
That is exactly what I want! But not what I am getting.
**** Ahoy!!!! The embeded image link returned! I got it!
The image links are like \imagename.jpg when they should be
generated as simply imagename.jpg. One leads to the root, the
other has the browser expand it to the "same URL
folder that the HTML file was requested from. "
Gambit, looks like simple user error.
Well at least it's the weekend. Go Padres.
Thank you for your patience,
"Remy Lebeau (Indy Team)" <email@example.com> wrote in message
> "tony meadors" <tonymeado…@adelphia.net> wrote in message
> > In response to a POST request (providing values) my INDY
> > server returns an HTML file with sendfile(). That file arrives fine,
> > but the followup image requests made by the browser are
> > always filename only, no path, so they are not grabbed.
> Your understanding of how HTTP actually works is a little lacking. You
> not taking into account that the browser has no concept whatsoever of your
> file system hierarchy actualy is on the server. Paths specified in the
> are URLs, not physical file system folders. Depending on what the actual
> HTML looks like, the browser is trying to load the image from the same URL
> folder that the HTML file was requested from. That has nothing to do with
> your file system paths. Resource paths in HTTP requests are always
> specified as URLs relative to the server's root folder ("/"), never as
> system paths.
> Let me give you an example. Assume a browser loads a page at
> http://www.myserver.com/page.html", and the HTML contains an image "<img
> src=image.jpg>". Since there is no '/' in the front of the URL of the
> image, the actual location of the image is relative to the URL of the HTML
> page. In this case, the full URL to the image is
> http://www.myserver.com/image.jpg" when expanded by the browser. That
> results in a "GET /image.jpg" request.
> It is your server code's responsibility to determine what physical folder
> relates to the URL's '/' root folder, and then apply the rest of the URL
> that physical folder. So if your root folder is at
> "C:\root\genfiles\temp\777", then a URL of "/image.jpg" would serve up
> > For example, this call:
> > Generates the following image call by the browser is:
> > GET \headerlogo.jpg
> What does the actual HTML look like? What URL is the browser actually
> to access report67.htm?
> Chances are, the page is being loaded via a URL that specifies the HTML
> is in the server's root folder, and the HTML contains a relative URL for
> image, so the browser requests the image from the same root folder that
> HTML file is requested from. Or else the HTML file is not in the root
> folder, but the HTML contains an image URL that begins with "/", so the
> browser is forced to load the image from the server's root folder.
> > What I would like to get from the browser is obvious:
> > GET \root\genfiles\temp\777\headerlogo.jpg
> For that to work, the URL of the HTML file would have to be
> http://www.server.com/root/genfiles/temp/777/page.html", or if the HTML
> contains an image URL of "/root/genfiles/temp/777/headerlogo.jpg".
> > The image(s) are located down in the 777 directory, not in the root.
> From the perspective of your file system, that is correct. But not from
> perspective of the URLs that are involved. All URLs for the erver are
> relative to the server's "/" root folder. Where the "/" actually points
> on your file system, that is up to your own code to manage.
> > How can I have GET image references use either,
> > the same directory stem as the original htm file
> By learning how HTTP and URLs actually work, and then update your code to
> use them properly. To load an image from the same folder as the HTML
> the HTML has simply to specify the image filename with no path, and the
> browser will expand the filename into a full URL accordingly. When a
> request is made to the server, the request always contains a full path
> starting at the "/" root folder, in terms of HTTP paths, not in terms of
> file system paths. You have to translate between the two in your code.
> > Possibly by setting values in requestinfo or responseinfo??
Re: Browser image requests - no path Info in GET posted by Remy Lebeau (Indy Team) on Fri, 29 Sep 2006