pathing issue? fpweb / HTTP Server Application lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- IPguy · 2012-06-19 01:42 I'm able to display the background when I point my browser to the file containing the below html code, but when I set the below file as my default file for my HTTP Server App, the background image (mos.gif) is not displayed. Any suggestions? Laz-1.1-36568-2.6.1, win32-Vista. Code: [Select]
I'm going to start over again with a new / clean program and see if I
continue to have the same issues.
----------------------------------------------------------------------
Leledumbo · 2012-06-22 06:50
I just opened your attachment and now I see you put
RegisterFileLocation in the wrong place. It should NOT be put in a
request, but prior to Application.Run. I still haven't tried your code
though (my office has a weird internet usage rules), I'll try whenever
I get access to my Lazarus.
----------------------------------------------------------------------
IPguy · 2012-06-22 11:35
re: RegisterFileLocation - I had played with putting that before
Application.run and I was still getting errors. (I do not remember
the error message at the moment.) I'll move RegisterFileLocation out
of the request tonight.
----------------------------------------------------------------------
Leledumbo · 2012-06-22 12:07
Try the attached project, you also miss the mime.types file (included
in attached project), which is used to determine what kind of mimetype
the server should send (could cause the browser to download instead of
display the image)
----------------------------------------------------------------------
IPguy · 2012-06-23 01:21
This appears to be worse.
I get the following error immediately after pointing my browser to the
app, both when
when running within the IDE and when I start the app up outside of the
IDE. Also with multiple browsers.
Code: [Select]The application encountered the following error:
Error: Could not determine HTTP module for request ""
Stack trace:
$00437DA3
$00438411
$0043AF0E
$0043AA7C
$0043AE1D
$0043916A
$0043AEC6
$00402CF8 main, line 15 of httpprojectPAR.lpr
I also added the line:
Code: [Select] MimeTypes.LoadFromFile('mime.types'); in the .lpr
file and that did not make a difference.
Leledumbo - What OS did you use to test this? What Laz version?
I'm using: Laz-1.1-36568-2.6.1, win32-Vista.
----------------------------------------------------------------------
Leledumbo · 2012-06-23 03:55
QuoteI get the following error immediately after pointing my browser
to the app, both when
when running within the IDE and when I start the app up outside of the
IDE. Also with multiple browsers.What's your URL? You didn't set any
default module/action so http://localhost:8081 would give you that
error. Use http://localhost:8081/main/default.
Quote also added the line:
MimeTypes.LoadFromFile('mime.types');
in the .lpr file and that did not make a difference.That's not
required, fpwebfile would automatically load it.
QuoteLeledumbo - What OS did you use to test this? What Laz
version?Kubuntu 12.04 & Windows XP SP3, all 32-bit
FPC 2.7.1 r21512
Laz 1.1 r37563M
----------------------------------------------------------------------
IPguy · 2012-06-23 23:59
localhost:8081 had been presenting the web page as expected (except
for the image issue).
I just upgrade Laz to 1.1-37738 (still 2.6.1). No change in
behavior. No image is display.
After recompiling the revised program you provided, the image still
does not show.
Any other thoughts? I could share this with the mailing list?
I still suspect my programming is the issue.
----------------------------------------------------------------------
Leledumbo · 2012-06-24 06:24
I give up. It works perfectly fine in my computer, both of my OS. Last
thing you might want to do: try requesting the image again directly
(http://localhost:8081/img/mos.gif) and see what your browser get. If
it downloads the image, then mime.types doesn't get loaded. If it can
display the image, that's weird. Otherwise, there's something wrong
and I have no clue what it is.
----------------------------------------------------------------------
BigChimp · 2012-06-24 09:53
Compiled it using x86 Laz 1.1 (SVN today), FPC 2.6.1 (SVN today),
Windows Vista x64
This URL Code: [Select]http://localhost:8081/main/default gives this
page source:
Code: [Select]
... but no mos.gif is shown... I get the alt text.
Direct image link: Code: [Select]http://localhost:8081/img/mos.gif
gives an error, no image
Is this how I should test it?
----------------------------------------------------------------------
IPguy · 2012-06-24 12:12
Leledumbo - requesting the image directly
(via:http://localhost:8081/img/mos.gif) shows a blank page. When I
view the source of that page, it is also blank.
I did add a .jpg image on my web page to see this was an issue with
.gif's. I was not able to see either image.
BigChimp - that is the result I get as well. I see the text but not
the image, although I'm not getting an error when I view the image via
http://localhost:8081/img/mos.gif with firefox. When using IE8, I do
get the message: webpage cannot be found.
Yes I believe this is how we should be testing it.
But Leledumbo does see the image. I'm confused.
BigChimp - what setup are you using?
IPGuy - Laz 1.1-37738-2.6.1, win32-Vista
Leledumbo -
Kubuntu 12.04 & Windows XP SP3, all 32-bit
FPC 2.7.1 r21512
Laz 1.1 r37563M
----------------------------------------------------------------------
BigChimp · 2012-06-24 14:20
Quote from: IPguyBigChimp - what setup are you using?
Quote from: BigChimp on June 24, 2012, 11:53:35 amx86 Laz 1.1 (SVN
today), FPC 2.6.1 (SVN today), Windows Vista x64
Quote from: IPGuyvia http://localhost:8081/img/mos.gif with firefox.
When using IE8, I do get the message: webpage cannot be found.
Yep, that's what I'm talking about - tested in IE. With either IE or
Firefox, I don't get the image.
----------------------------------------------------------------------
Leledumbo · 2012-06-24 14:23
My bad... looks like I forgot one line in the .lpr:
Quote...
ImageDir := GetCurrentDir + DirectorySeparator;
MimeTypesFile := 'mime.types';
RegisterFileLocation('img',ImageDir);
...
Please add the bold line. Somehow Chrome (sorry, I didn't say it
earlier. I quit using FF and IE since I found Chrome) is able to
detect the real content type despite it's sent as application/octet-
stream.
----------------------------------------------------------------------
IPguy · 2012-06-24 14:49
I've been using FF, IE and Chrome. No luck with any of them.
Leledumbo, I added the mime line to the .lpr, but that did not make
any difference. I still do not see an image. No difference if I run
the app inside the IDE or outside the IE.
One difference between our setups is that Leledumbo is using 2.7.1 and
BigChimp and I are using 2.6.1.
If there are no other thoughts, I'll open a bug report on this.
Thanks for your help.
----------------------------------------------------------------------
Leledumbo · 2012-06-24 16:29
QuoteOne difference between our setups is that Leledumbo is using
2.7.1 and BigChimp and I are using 2.6.1That could be the problem or
not. Could you try diff-ing the 2.7.1 and 2.6.1 source of fcl-web?
----------------------------------------------------------------------
IPguy · 2012-06-24 19:33
comparing 2.6.1, dated 2012/6/23 & 2.7.1-v21686:
httpdefs.pp differs
adding free content stream code
custweb.pp differs
added new property - defaultModuleName & associated code
I'll attempt switching over to 2.7.1 and see if that makes a
difference.
----------------------------------------------------------------------
IPguy · 2012-07-05 23:16
Finally have fpc 2.7.1 installed.
No change - I still do not see the images.
I'm going to open a bug report.
Using laz-1.1-37884, fpc 2.7.1 21798, win32-Vista....