Dart Home | PowerTCP Web Enterprise for ActiveX | Custom Development | Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums |
Author | Forum: PowerTCP Web Enterprise for ActiveX Topic: Problems with NTLM and more... |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 10, 2002 3:45 AM 1. The application we need to build downloads a file from a web server process it and then uploads it back to the server. Our client uses a MS proxy with NTLM authentication, and every time the application posts the file back to the server the application throws an error: “12032 : The Win32 Internet function needs to redo the request.” This never happens if we test without the NTLM proxy. 2. We’ve notice that the DartWeb.dll imports function from Wininet.dll although in the Dart help it says: “No dependency on WinInet.dll. We have replicated and improved the functionality in our product.”. care to explain ? 3. Every time the user closes the application the WebControl component cases the application to hang for a minute, a minute and a half. Explanation ? Any one else got this ? Development done using VB6 Thanks alot. |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted October 10, 2002 11:29 AM Hi, 1) You should be able to get through the proxy if the first request made is a Get or Head. 2) The Http control (found in the Web and Web Enterprise Tools) uses Wininet. The WebAsp control is the one that does not. 3) No. Does this happen with the sample, and the latest update? http://www.dart.com/downloads/update.exe Regarding NTLM, while the Web control supports it, we are currently looking into supporting it in the WebAsp control as well. -ken |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 11, 2002 2:39 AM 1. my first request is always HEAD to get the authentication... 3. with the samples happend on and off, and on some machines only. Havent try the update yet. I'll get back on this one. |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted October 14, 2002 12:08 PM Hi, What about a Get? This works for our other customers. If this does not work, my advise would be to use a protocol sniffer, and then examine the communication between: a) your server and the control, and b) your server and IE (assuming it works with IE) and then compare the two for differences. -ken |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 15, 2002 5:23 AM Unfortunatly sniffing the network is not possible. The only problem we have at this time it's the “12032 : The Win32 Internet function needs to redo the request.” error that occures when we try to POST a file to the server. The GET works just fine. Any similar experience ? Anyone ? We would appreciate any help.... |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 15, 2002 5:26 AM Just read on a previous thread (Forum: Questions about the PowerTCP Web Enterprise Tool Topic: Support for NTLM) that "The Web control, which is WinInet-based and part of the Web Enterprise package, will handle NTLM, but only with a Get command". Is that true ? Why is that so ? |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted October 15, 2002 8:54 AM Hi, Yes, but after the Get you should be able to do a Post, as you are now past the authentication. The proxy does not allow other commands (such as Post) as the initial request. This is the nature of the proxy. NTLM is MS's proprietary authentication scheme. They do not provide info for traversing it, but the Web Tool works because it uses MS's Wininet dll. -ken |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 15, 2002 8:59 AM The sequence is: Head Get Head Post Is this ok or we should take out the second Head ? |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted October 15, 2002 9:14 AM Hi, Neither Head should be necessary, but I do not see why this wouldn't work. -ken |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 15, 2002 9:23 AM We use the Head to check the connection. We'll try to take out the second Head and see how it works. We'll keep you POSTed. Thanks for all the help. |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 16, 2002 6:48 AM We've tried to do a Get just befor the Post and we still get the same error: "12032 : The Win32 Internet function needs to redo the request.". What other options do we have ? Please advise! |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted October 16, 2002 9:33 AM Hi, Does the Get work? If so, are you including the Session cookie from this request in the Post? If it were me (assuming it works with IE), I would examine what IE does to get through, and then do the same with the control. You can trial an easy-to-use sniffer from here: http://www.sstinc.com/home_webanal.html -ken |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 18, 2002 3:26 PM The Get works fine. Using a sniffer you can see the Get retrying (and sending the necessary authentication messages) until it gets a 200 from the server. The Post fails all the time. Using the same sniffer and posting a file from IE we realized that IE actualy posts the file 3 times each time adding the authentication message required. That means Dart doesnt models the IE way of posting. We tryed to do a Get and imediatly a Post but the result it's the same. Fails!!! Why ? Please advise ASAP. |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted October 19, 2002 8:28 AM Latest news: we managed to make it run... There are a few things we didn’t know.... The GET response returned by the server during the authentication must be of the same type as the POSTed content. In our case "application/pdf". If the server returns another type, the POST message requires authentication and the loop starts again. We’ve returned a 0 length response of type "application/pdf". Another thing that came to out attention is that between the GET and the POST it has to be a time difference. If the POST it’s done immediately after the GET you get random errors like: Miscellaneous Error, Application defined error, Unknown Error, etc. Our guess is that the Dart component needs a short time to close regain the “available” state. The trick is to “sleep” a second or so while allowing the component to do it’s job. Small piece of code found on the web does that (if anyone has a better one we don’t mind if they share it with us :P – we’re java programmers not VB ): Public Sub Wait() Dim lngCt As Long Dim intYieldCt As Integer lngCt = 0 Do While lngCt < 1000000 For intYieldCt = 1 To 1000 lngCt = lngCt + 1 dblDummy = lngCt * 3.14159 Next intYieldCt ' ' The DoEvents statement allows Http component do do whatever it does DoEvents Loop End Sub With all this in place the NTLM authentication works nicely and smoothly ... so far. We hope this will help other people who have the misfortune of dealing with Microsoft NTLM proxies. Regards, Ovidiu |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted October 21, 2002 8:43 AM Hi, Thank you for posting your findings for others to see. -ken |
LCottrell From: Southport, United Kingdom Posts: 1 Member Since: 02/09/04 |
posted February 9, 2004 6:12 AM Is there any chance you could post a few more lines of sample code, to show the get then the wait then the get and finally the post. I am having troubles working this out. Cheers Lee |
ovidiu From: Singapore, Singapore Posts: 10 Member Since: 10/10/02 |
posted February 9, 2004 11:02 PM It has been a while since I have done this. The application has been in production for many months now and working without any problems!!! I striped the codes so that I post only the relevant part. --------------------------------------- Public Sub Upload(file As String) On Error GoTo ErrorLabel: Dim intFile As Integer Dim contentLength As String Dim RequestHeader As New DartStrings Dim ResponseHeader As New DartStrings Dim Data As String Dim ResultData As String intFile = FreeFile() Open TEMP_DIR & file For Binary Access Read Shared As #intFile contentLength = LOF(intFile) frmWait.httpConn.Timeout = 30000 Data = String(contentLength, 0) Get #file, , Data 'read the file content httpConn.url = "http://127.0.0.1/servlet/FileUpload" 'set headers RequestHeader.Delimiter = vbCrLf RequestHeader.add ("Proxy-Connection: Keep-Alive") RequestHeader.add ("Connection: Keep-Alive") RequestHeader.add ("Accept: text/*, text/html, application/pdf") RequestHeader.add ("Content-Length: " & contentLength) RequestHeader.add ("Content-Type: application/pdf") ' post the request httpConn.Post Data, RequestHeader, ResultData, ResponseHeader If httpConn.Status <> 200 Then ' not OK ? MsgBox "The server generated an error." & vbCrLf & vbCrLf & """" & httpConn.StatusText & """ [" & httpConn.Status & "]" , vbCritical + vbOKOnly End If Exit Sub ErrorLabel: Select Case err.Number Case httpForceRetry 'The Win32 Internet function needs to redo the request. (12032) ' Wait for a while allowing the prev connection to be closed.... Wait ' this is where we actualy get authenticated httpConn.Get ResultData, ResponseHeader ' Wait again Wait err.Clear Resume Case Else 'Anything else means ERROR! If MsgBox("An error has occured while saving file [" & file & "]." & vbCrLf & "Would you like to try again ?", vbQuestion + vbYesNo + vbDefaultButton2, "Retry") = vbYes Then Call Upload(file) Exit Sub End If End Select err.Clear End Sub ------------------------------------------ - "httpConn" is the Http component from Dart. - "Wait" is the method posted earlier. - the GET method of the "FileUpload" servlet returns a 0 (zero) byte PDF content. From our experience the proxy will reset the connection if the content type is changed. - the POST method will read the posted file. I hope this helps, Ovidiu |
Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums |
This site is powered by
![]() |