Sure. Good to discuss though in case others are using Kaju and run into similar problems.
Don't do a version with the number 4.0.4.
I wanted to check why I get "an error occurred" when loading an update after updating from 4.0.3 to 4.0.4. I changed the version information to an older version and did some debugging. When coming to the code
dim raw as string = http.Get( url, 10 ) if http.HTTPStatusCode = 404 or instr(raw, "404") > 0 then // Not found mResult = ResultType.NoUpdateAvailable exit do elseif raw = "" then if HandleError( KajuLocale.kErrorNoUpdateData ) then continue do else exit do end if end if
it looked at first glance like the socket had problems with getting the update data. Instead I have a download url
This is the original code:
dim raw as string = http.Get( url, 5 ) if http.HTTPStatusCode = 404 then // Not found mResult = ResultType.NoUpdateAvailable exit do elseif raw = "" then if HandleError( KajuLocale.kErrorNoUpdateData ) then continue do else exit do end if end if
@Beatrix W Hmm.. as the senior moments are getting worse and worse: I seem to remember that the socket didn't give the proper status code. Therefore, I added the code to shoot myself into the foot.
Perhaps you might want to search for "file not found" in the response text instead of "404"
It's not exactly a good workaround for the socket not having the right response code, but it's less likely to result in a false positive match.
Ran into this issue again and found out what is causing it. I've got something in my htaccess file that makes a redirect to another page. This also affects Kaju. I get
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>302 Found</title></head><body><h1>Found</h1><p>The document has moved <a href="http://www.mothsoftware.com/errors/404/index.html">here</a>.</p></body></html>
as result if I use a wrong url. The socket doesn't have a 404 status code because there is a page after all. Does anyone have a better idea than checking for "<title>302 Found</title>"?
Let's start from the beginning. I want to improve this code here:
if http.HTTPStatusCode = 404 then mResult = ResultType.NoUpdateAvailable exit do
Since I never ever screw anything up I want that to work with my website in case I delete the json file or whatnot. Let's say I use this code with
url = "http://www.mothsoftware.com/test.json"
To make my website nicer what would normally give a 404 error is redirected to
The socket doesn't give a status code of 404 because there is a page. Checking for a 404 in the result was a really bad idea which screwed up my release 4.0.4. At the moment my code looks like this
if http.HTTPStatusCode = 404 or instr(raw, "<title>302 Found</title>") > 0 then // Not found mResult = ResultType.NoUpdateAvailable dim theAlert as new MessageDialog theAlert.Message = KajuLocale.kErrorBadUpdateData call theAlert.ShowModal exit do
with an added error message. The question is, if there is a better solution than the instr check. Checking for redirection didn't change anything. Wouldn't make a difference since I don't want the redirection anyways. I can't find what I did to my htaccess file. But I would have thought that having a nice 404 is a common thing to do for websites.
@Beatrix W The socket doesn't give a status code of 404 because there is a page.
This is incorrect behavior. Yes, there is a page, but it's not the content the user was looking for, it's a "not found" error, so this page should always return status 404, not 200. Nobody goes to that page intentionally.
Having said that, I'm not sure what the problem is. Yes, Kaju will think it got to a valid url even though it didn't, but the later code that looks for the signature and JSON data should flag it, no?
You can also change the code this way:
if http.HTTPStatusCode <> 200 then ...
In fact, that might be a good change for the project anyway.
It turns out that, sometimes, the App.UpdateInitiater's Destructor will not fire automatically on quit. This will manifest as the user pressing the button to update, the app quitting, and nothing more.
The solution is to add this line to the App.Close event:
App.UpdateInitiater = nil
That will force the matter and all will be well. I'll add that to the README shortly.
I could use some advice from my Windows peeps...
The 64-64-bit updates are working fine as are the 32-32-bit updates. The problem arises when I attempt a 32-64-bit update. It seems to launch fine but then I get an error from "cefsubproc.exe" -- "The application was unable to start correctly (0xc000007b). Click OK to close the application."
I understand it's because the 32-bit app that was running is trying to launch a 64-bit version and that confuses Windows for some reason. In fact, if I manually quit and restart the app, it works just fine.
What's the best workaround? Is it just to tell the user to start the app manually?
I've released v.2.0 so please go to the following topic to continue the conversation: