Kaju self-updater talk (v.1.x)

  1. ‹ Older
  2. 6 months ago

    Sure. Good to discuss though in case others are using Kaju and run into similar problems.

  3. Beatrix W

    Feb 22 Pre-Release Testers Europe (Germany)

    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

    "URL":"http://www.mothsoftware.com/downloads/MailArchiverX404.dmg"

  4. Beatrix W

    Feb 22 Pre-Release Testers Europe (Germany)

    The download complete event has the same problem:

    if instr(url, "404") > 0 then
  5. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    D'oh!

  6. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    Wait, that's not in the project code...

  7. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    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
     
  8. Tim P

    Feb 23 Pre-Release Testers, Xojo Pro

    For anyone who didn't notice the difference like me, Beatrix's version is checking the response text for "404" as well.

  9. Kem T

    Feb 23 Pre-Release Testers, Xojo Pro New York

    Right. I'm not sure why that's needed, but it you really want to do that, at least use a regular expression to make sure the 404 is standalone, and something else to make sure the JSON markers for the packet are not there.

  10. Beatrix W

    Feb 23 Pre-Release Testers Europe (Germany)

    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.

  11. Tim P

    Feb 23 Pre-Release Testers, Xojo Pro
    Edited 6 months ago by Tim P

    @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.

  12. 4 months ago

    Beatrix W

    Apr 21 Pre-Release Testers Europe (Germany)

    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>"?

  13. Kem T

    Apr 21 Pre-Release Testers, Xojo Pro New York

    Did you try setting AllowRedirection?

  14. Beatrix W

    Apr 21 Pre-Release Testers Europe (Germany)

    I tried allowRedirection but this doesn't change anything. I want to know if there is a 404 error not if there is a redirect.

  15. Kem T

    Apr 21 Pre-Release Testers, Xojo Pro New York

    Oh. The page it redirects to doesn't return 404? But it should, right?

  16. Beatrix W

    Apr 22 Pre-Release Testers Europe (Germany)
    Edited 4 months ago by Beatrix W

    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

    http://www.mothsoftware.com/errors/404/index.html

    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.

  17. Kem T

    Apr 22 Pre-Release Testers, Xojo Pro New York

    @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.

  18. 3 months ago

    Kem T

    May 25 Pre-Release Testers, Xojo Pro New York

    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.

  19. Kem T

    May 25 Pre-Release Testers, Xojo Pro New York

    It turns out this was the same issue for the 64-bit version so, after a few more tests, v.2.0 should be ready to go.

  20. Kem T

    May 25 Pre-Release Testers, Xojo Pro New York

    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?

  21. Kem T

    May 31 Pre-Release Testers, Xojo Pro New York

    I've released v.2.0 so please go to the following topic to continue the conversation:

    https://forum.xojo.com/40978-kaju-self-updater-talk-v-2-x

or Sign Up to reply!