Announcement

Collapse
No announcement yet.

Code quit working on Windows 10 32-bit

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code quit working on Windows 10 32-bit

    I extensively use this code, but can't get to work on 32-bit Windows 10.
    It works fine on Windows 11 64-bit. I tried after uninstalling recent Windows 10 updates.
    The only major change is that I am using Abyss Web server instead of a remote server.
    wsError returns "No send response" when using Windows 10 32-bit.
    Code:
    #DIM ALL
    #INCLUDE "httprequest.inc"
    FUNCTION PBMAIN() 'pbtest.bas
     LOCAL wsurl,wsusername,wspassword,wsdata,wserror AS WSTRING
     wsUrl   = "https://dotysoftware.com/test.txt"
     wsUserName = ""
     wsPassword = ""
     wsError = DownloadTest(wsUrl,wsUsername,wsPassword,wsData)
     ? wsData,,sError 'results: Frank Burns eats worms.   OK
    END FUNCTION
    
    FUNCTION DownloadTest(wsURL   AS WSTRING,_
                  wsUserName      AS WSTRING,_
                  wsPassword      AS WSTRING,_
                  wsDataReturned  AS WSTRING) AS WSTRING 'returns OK or error message
     RESET wsDataReturned
     DIM pHttpReq AS IWinHttpRequest
     pHttpReq = NEWCOM "WinHttp.WinHttpRequest.5.1"
     IF ISNOTHING(pHttpReq) THEN
      ? "WinHttpRequest.5.1 failure",%MB_ICONERROR OR %MB_SYSTEMMODAL,FUNCNAME$
      EXIT FUNCTION
     END IF
     pHttpReq.Open "GET", wsURL, 0
     pHttpReq.SetCredentials wsUserName, wsPassword, %HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
     pHttpReq.Send
     IF pHttpReq.StatusText <> "OK" THEN
      IF pHttpReq.StatusText = "" THEN
        FUNCTION = "No send response"
      ELSE
        FUNCTION = pHttpReq.StatusText
      END IF
     ELSE  'success
      wsDataReturned = pHttpReq.ResponseText
      FUNCTION = pHttpReq.StatusText
     END IF
     pHttpReq = NOTHING
    END FUNCTION
    Last edited by Mike Doty; 14 Sep 2022, 11:04 PM.

  • #2
    > include "httprequest.inc"

    YJust to be sure - you are using José's includes?

    Comment


    • #3
      Hi, yes.
      Cold booted server and the 32-bit machine.
      Cleared browser cache.
      Tried allowing only https and https + http.
      About to run sfc /scannow and chkdsk /f on Windows 10 machine.
      Didn't help. Also changed from wstring to string as Stuart suggested in next post.

      Comment


      • #4
        Just a WAG, does the Abyss server require ANSI or UTF8 rather than WSTRINGs?

        Comment


        • #5
          I'll change from wstring and see what happens.
          Same thing. This is bizarre.

          If anyone has a 32-bit version of Windows, please try the code.
          I know the code worked before Windows 11 on the Windows 10 machine.
          This is a tough one. Not using any virtual software. Running a full virus scan.
          Might have to reinstall Windows 10 32-bit on the machine.

          Comment


          • #6
            Is this using a PB CGI application?

            Obviously not when I looked at the code

            Comment


            • #7
              Hmm. Just tried your code.

              Pointing my browser to https://dotysoftware.com/test.txt displays "Frank Burns eats worms"

              Compiling and running your code in WIn10 64bit (PBWin 10.04) ( after changing ? wsData,,sError to ? wsData,,wsError ) returns "No send response", so the 32 bit is a red herring.

              Comment


              • #8
                Both these work on Windows 11. Neither work on Windows 10 32-bit.
                wsUrl = "https://www.dotysoftware.com/test.txt"
                wsUrl = "https://dotysoftware.com/test.txt"

                Comment


                • #9
                  Installed new browser and changed to it. No effect. I will later reinstall Windows 10 32-bit.
                  Thanks for checking it out.

                  Comment


                  • #10
                    Mike,
                    One posibility
                    your site uses TLS1.3 only
                    In Windows 11 WinHttp probably also uses TLS1.3 by default
                    In Windows 10, WinHttp uses TLS1.2

                    Most recent browser now use TLS1.3

                    if you use my code with error trapping you get

                    ---------------------------
                    Error
                    ---------------------------
                    Error code: &H80072F7D [-2147012739]
                    Description: An error occurred in the secure channel support

                    Source: WinHttp.WinHttpRequest
                    GUID: {016FE2EC-B2C8-45F8-B23B-39E53A75396B}
                    ---------------------------
                    OK
                    ---------------------------​


                    '
                    Code:
                    #DIM ALL
                    #INCLUDE "httprequest.inc"
                    FUNCTION PBMAIN() 'pbtest.bas
                     LOCAL wsurl,wsusername,wspassword,wsdata,wserror AS WSTRING
                     wsUrl   = "https://www.dotysoftware.com/test.txt"
                     'wsUrl   =  "https://howsmyssl.com/a/check"
                     wsUserName = ""
                     wsPassword = ""
                    
                     ? GetHTTPsfromWEB (wsUrl)
                    END FUNCTION
                    
                    
                    #INCLUDE ONCE "httprequest.inc"
                    #INCLUDE ONCE "ole2utils.inc"
                    '-----------------------------------------------
                    FUNCTION GetHTTPsfromWEB (sFullURL AS WSTRING) AS WSTRING
                    '-----------------------------------------------
                    ' GetHTTPsfromWEB
                    ' Opens an HTTP or HTTPS connection to an HTTP resource
                    ' Usage     GetHTTPsfromWEB (sFullURL)
                    ' Usage     GetHTTPsfromWEB ("https:/www.mydomain.com/whatever.html)
                       LOCAL pWHttp AS IWinHttpRequest
                       LOCAL buffer AS STRING
                       LOCAL iSucceeded AS INTEGER
                    
                       ' Creates an instance of the HTTP service
                       pWHttp = NEWCOM "WinHttp.WinHttpRequest.5.1"
                    
                       IF ISNOTHING(pWHttp) THEN EXIT FUNCTION
                       TRY
                          ' Opens an HTTP or HTTPS connection to an HTTP resource
                          pWHttp.Open "GET", sFullURL
                          'pWHttp.SetCredentials "", "", %HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
                          ' Sends an HTTP request to the HTTP server
                          pWHttp.Send
                          ' Wait for response with a timeout of 5 seconds
                          iSucceeded = pWHttp.WaitForResponse(5)
                             buffer = pWHttp.Responsetext
                       CATCH
                          OleShowErrorInfo OBJRESULT
                       END TRY
                    FUNCTION = buffer
                    END FUNCTION
                    '-----------------------------------------------
                    ' GetHTTPsfromWEB                            End
                    '-----------------------------------------------
                    
                    '


                    Result from your Site:

                    Click image for larger version

Name:	mike.png
Views:	107
Size:	56.1 KB
ID:	818768

                    Comment


                    • #11
                      Originally posted by Rod Macia View Post
                      Mike,
                      One posibility
                      your site uses TLS1.3 only
                      In Windows 11 WinHttp probably also uses TLS1.3 by default
                      In Windows 10,WinHttp uses TLS1.2
                      Most recent browser now use TLS1.3
                      Good bit of detective work.

                      From SocketTools:
                      " Windows TLS 1.3 Support
                      Microsoft has not provided a roadmap for their implementation of TLS 1.3 on Windows 10 and later versions. They have added TLS 1.3 as an option for Windows 10 Build 1903, but have stated this is for testing purposes and should not be used in a production environment. When Microsoft enables TLS 1.3 in the Schannel SSPI for release versions of Windows, SocketTools will support this capability.



                      And according to this page:
                      https://docs.microsoft.com/en-us/win...-schannel-ssp-

                      TLS1.3 is "Not Supported" on any version of WIn10


                      What is that screen capture from? (I want it! )

                      Comment


                      • #12
                        Originally posted by Stuart McLachlan View Post
                        What is that screen capture from? (I want it! )
                        Here you go.

                        https://www.cdn77.com/tls-test/resul...tysoftware.com

                        https://www.site24x7.com/tools/tls-checker.html

                        Comment


                        • #13
                          Thanks very much.
                          I reduced security to also allow TLS 1.2
                          Great catch!!

                          Comment


                          • #14
                            Originally posted by Mike Doty View Post
                            Thanks very much!
                            I reduced secured to also llow TLS 1.2
                            And now it works on my 64bit WIn 10

                            Comment

                            Working...
                            X