Re: [twsocket] HttpSrv: implementing NTLM
Yes, and now I partially know how the client works internally. But I never worked on the source of the server, so I should first learn how it works internally. It's quite simple. Each client has his own TWSocket instance. This reduce the problem to a single user. I checked (very quickly) the code but I don't understood how it handle the basic authentication. There is nothing in the component. It has to be handled at the application level. Code has been published to show how to do it. I don't remember where :-( Is there already a similar situation, i.e. the component exchange automatically more that one request with the client? That's normal HTTP 1.1 behaviour. Speaking about the NTLM, I don't know if it will be correct to don't use the Windows domain user base. Probably it is the only reason to use the NTLM instead other authentications. Yes, this is one interesting point in NTLM . But also NTLM offer true protection agains transmitting passwords over the internet. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Maurizio Lotauro [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Monday, June 20, 2005 3:32 AM Subject: Re: [twsocket] HttpSrv: implementing NTLM On 19-Jun-05 09:11:21 Francois PIETTE wrote: Is there someone willing to implement NTLM authentication into HTTP server component ? If no other has offered yourself I can help you in this but only if you have a documentation how to it should work. Otherwise I have no idea how to start it. Well, we have the client side, you participated a lot in that development. Yes, and now I partially know how the client works internally. But I never worked on the source of the server, so I should first learn how it works internally. So it should not be too difficult to build the replies the server has to do. I think that the main problem is to handle automatically all steps of the authentications. As said, I must first examine and understand how the component works. Is there already a similar situation, i.e. the component exchange automatically more that one request with the client? I don't want to peek into Windows user base, just implement the NTLM authentication protocol. A simple event to get the usercode/password from the application host the server component is enough. This should be true for authentication in general, not only for NTLM. I checked (very quickly) the code but I don't understood how it handle the basic authentication. Speaking about the NTLM, I don't know if it will be correct to don't use the Windows domain user base. Probably it is the only reason to use the NTLM instead other authentications. Bye, Maurizio. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] HttpTst: Can erad xml on LAN, what am I doing wrong for internet?
Bear with me? I suspect the question will be easy for someone... but I have to set a scene: I have written an HTTP client app, using ICS. The heart of my program was created from the ICS demo HttpTst. The program fetchs some XML from a little box you can plug into a LAN or the internet. The XML tells the client about temperatures or humidities sensors on the box can see. The Big Puzzle: If I point my client at a server on my LAN, the XML is collected as expected. However, even after I turn my firewall off (which was part of the problem!), if I point it at... http://80.250.3.197/temper.xml ... which is the right page in another of the boxes, my client says... Not using proxy cmd POST /temper.xml HTTP/1.0 cmd Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* cmd Connection: Keep-Alive cmd Content-Type: text/plain cmd User-Agent: Mozilla/4.0 (compatible; ICS) cmd Host: 80.250.3.197 cmd Content-Length: 0 cmd RequestDone, no error. Status =0 StatusCode = 0 (No route to host (Error #10065)) If I point my browser at the same URL, using the same pc, I get a sensible response. The command summary is similar to the above, but after the Content-Length: 0 and cmd, I get text/html= temper.xml Location=http://192.168.0.26/temper.xml URL = http://192.168.0.26/temper.xml Document = temper.xml RequestDone, no error. Status =200 StatusCode=200(OK) When I adapted (plndered?) the ICS demo HttpTst to provide the heart for my program, I trimmed it down to focus just on the things I needed, understood. MAYBE SOME KIND READER CAN SEE WHERE I CUT TOO MUCH? I suspect my error lies somewhere in my preparation for the request Most of what was in HttpTst is still present below, but bits have been remmed out... anyone see a bit that's needed for across-the-internet, but not critcal in across-LAN?... begin Request:=httpPOST; DisplayMemo.Clear; DocumentMemo.Clear; try DataOut := TMemoryStream.Create; Buf := '';//DataEdit.Text; if Length(Buf) 0 then { Check if some data to post } DataOut.Write(Buf[1], Length(Buf)); DataOut.Seek(0, soFromBeginning); //if NoBasicAuthCheckBox.Checked then // HttpCli1.Options := HttpCli1.Options + [httpoNoBasicAuth] //else HttpCli1.Options := HttpCli1.Options - [httpoNoBasicAuth]; {if NoNTLMAuthCheckBox.Checked then HttpCli1.Options := HttpCli1.Options + [httpoNoNTLMAuth] else } HttpCli1.Options := HttpCli1.Options - [httpoNoNTLMAuth]; HttpCli1.FollowRelocation := true;//not NoRelocCheckbox.Checked; HttpCli1.SendStream := DataOut; HttpCli1.Proxy:= '';// ProxyHostEdit.Text; HttpCli1.ProxyPort:= IPPort.Text; HttpCli1.Connection := 'Keep-Alive'; HttpCli1.RcvdStream := nil; HttpCli1.ContentTypePost := 'text/plain';//PostContentTypeEdit.Text; HttpCli1.Cookie := '';//CookieEdit.Text; HttpCli1.URL := 'http://'+IPAddress.text+'/temper.xml';//URLEdit.Text; HttpCli1.RequestVer := '1.0';//'1.' + // IntToStr(HttpVersionComboBox.ItemIndex); if HttpCli1.Proxy '' then Display('Using proxy ''' + HttpCli1.Proxy + ':' + HttpCli1.ProxyPort + ) else Display('Not using proxy'); try if Request = httpPOST then HttpCli1.Post else HttpCli1.Put; except DataOut.Free; Display('POST Failed !'); Display('StatusCode = ' + IntToStr(HttpCli1.StatusCode)); Display('ReasonPhrase = ' + HttpCli1.ReasonPhrase); Exit; end; DataOut.Free; Display('StatusCode = ' + IntToStr(HttpCli1.StatusCode) + ' (' + HttpCli1.ReasonPhrase + ')'); {if DisplayHeaderCheckBox.Checked then for I := 0 to HttpCli1.RcvdHeader.Count - 1 do Display('hdr' + HttpCli1.RcvdHeader.Strings[I]); } if HttpCli1.ContentLength = 0 then DocumentMemo.Lines.Add('No document received.') else begin DataIn := TFileStream.Create(HttpCli1.DocName, fmOpenRead); try if Copy(HttpCli1.ContentType, 1, 5) = 'text/' then DocumentMemo.Lines.LoadFromStream(DataIn) else begin DocumentMemo.Lines.Add('Content type is ' + HttpCli1.ContentType); DocumentMemo.Lines.Add('Document stored in ''' + DocFileName + ''' Size=' + IntToStr(DataIn.Size)); end; finally DataIn.Free; end;
Re: [twsocket] HttpTst: Can erad xml on LAN, what am I doing wrong for internet?
Many thanks for the quick reply! I've spent 2 hours trying Get instead of Post... there are still some areas I could explore... maybe Get is better, and I'm just meeting the NEXT problem, but Are you sure Get is the way to go? So far: My program works.. for LAN, not internet, if I use Post. Doesn't work at all with Get. What I'm trying to do: I'm trying to mimic using a browser to access http://192.168.0.26/temper.xml .. and get the XML it returns into a memo on my form. (If you point a browser at that URL, you can see the XML.) = I thought Post was the way to go, 'cause I was posting a request to the LAN/internet... as I say, it seems to work, up to a point (i.e. I've got some things right!) Does a Get have built into it a send request to url followed by (somehow) collect the answer? As I said... I'm quite willing to do my own work; I will spend more time digging in the code, trying to understand, but a little encouragement telling me I'm at least banging my head against the right wall would be very welcome!! :-) Tom (Apologies for my typo in the subject line) On 21 Jun 2005 at 13:01, Francois Piette wrote: cmd POST /temper.xml HTTP/1.0 Why are you using Post ? It should probably be a Get. -- [EMAIL PROTECTED] http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be http://sheepdogsoftware.co.uk Freeware, shareware. Kids, parents, schools... and others. ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] HttpTst: Can erad xml on LAN, what am I doing wrong for internet?
Are you sure Get is the way to go? Yes because you say you get the URL using a browser. My program works.. for LAN, not internet, if I use Post. Doesn't work at all with Get. Please go back to HttpTst and try to get the URL. It works from here using the URL http://80.250.3.197/temper.xml. Note that you may have to set the proxy properties on the HTTP component depending on how you are connected to the internet. This very basic code will download your document: procedure TForm1.Button1Click(Sender: TObject); begin HttpCli1.URL := 'http://80.250.3.197/temper.xml'; // Uncomment following lines if using a proxy //HttpCli1.Proxy := 'your_proxy_hostname'; //HttpCli1.ProxyPort := 'your_proxy_port'; HttpCli1.RcvdStream := TMemoryStream.CReate; HttpCli1.Get; HttpCli1.RcvdStream.Seek(0, 0); Memo1.Lines.LoadFromStream(HttpCli1.RcvdStream); HttpCli1.RcvdStream.Free; end; -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: TK Boyd [EMAIL PROTECTED] To: ICS support mailing twsocket@elists.org Sent: Tuesday, June 21, 2005 3:32 PM Subject: Re: [twsocket] HttpTst: Can erad xml on LAN,what am I doing wrong for internet? Many thanks for the quick reply! I've spent 2 hours trying Get instead of Post... there are still some areas I could explore... maybe Get is better, and I'm just meeting the NEXT problem, but Are you sure Get is the way to go? So far: My program works.. for LAN, not internet, if I use Post. Doesn't work at all with Get. What I'm trying to do: I'm trying to mimic using a browser to access http://192.168.0.26/temper.xml .. and get the XML it returns into a memo on my form. (If you point a browser at that URL, you can see the XML.) = I thought Post was the way to go, 'cause I was posting a request to the LAN/internet... as I say, it seems to work, up to a point (i.e. I've got some things right!) Does a Get have built into it a send request to url followed by (somehow) collect the answer? As I said... I'm quite willing to do my own work; I will spend more time digging in the code, trying to understand, but a little encouragement telling me I'm at least banging my head against the right wall would be very welcome!! :-) Tom (Apologies for my typo in the subject line) On 21 Jun 2005 at 13:01, Francois Piette wrote: cmd POST /temper.xml HTTP/1.0 Why are you using Post ? It should probably be a Get. -- [EMAIL PROTECTED] http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be http://sheepdogsoftware.co.uk Freeware, shareware. Kids, parents, schools... and others. ___ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Simply a graphics browser
Is there a simple way to implement a sort of graphics browser (like IE - and probably only like IE) in your own user interface? Is it possible to be done with ICS? If not can you support me with the name of a component that would do this? I need this mainly to run a javascript from the url which i GET - because getting an URL doesn't make the script to run;] Or maybe there is a different way? Thx for help in advance! Julian Sychowski -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Simply a graphics browser
A browser is much much more than simply getting HTML and other kind of documents. Writing a complete browser is really a huuge task. I suggest you simply use TWebBrowser component within your Delphi application. TWebBrowser component is the heart of IE into and ActiveX. So you program will be IE with another user interface. Have a look here: http://www.euromind.com/iedelphi/index.htm This is really out of topic here. So please move to delphi@elists.org (same server, different mailing list) to discuss this topic. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: Julian S. [EMAIL PROTECTED] To: twsocket@elists.org Sent: Tuesday, June 21, 2005 7:59 PM Subject: [twsocket] Simply a graphics browser Is there a simple way to implement a sort of graphics browser (like IE - and probably only like IE) in your own user interface? Is it possible to be done with ICS? If not can you support me with the name of a component that would do this? I need this mainly to run a javascript from the url which i GET - because getting an URL doesn't make the script to run;] Or maybe there is a different way? Thx for help in advance! Julian Sychowski -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] HttpTst: Can erad xml on LAN... stop press!!
Hurrah!! I've found that with the demo HttpGet, I can make what I need happen. Now I just have to transplant the essentials into my own app Thanks for the help, encouraging me to keep at the problem... Tom (Free data logging program and sourcecodenow at http://sheepdogsoftware.co.uk/ssDD60.zip .. still a few rough edges, but mostly works.) http://sheepdogsoftware.co.uk Freeware, shareware. Kids, parents, schools... and others. ___ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] No response problem [THttpServer - TCustomLineWSocket]
Ok, thanks so much. I made the changes and it works (though I didn't tested extensively yet). For reference, this is what I did: - use of Connection.PostedDataReceived in the PostedData-event - I don't use LineMode at all (no change if I do) - Changing the way I was answering to GET commands from SendStream to AnswerString. I guess my calculation of the size in the header was wrong. Anyway it simplifies the code. I did ICS updates frequently, but I realized I didn't checked the new webserv demo correctly. I didn't know at all for the AnswerString function, for example. And if my memory is correct I never used PostedDataReceived either. First time I downloaded ICS was maybe 4 years ago or something ;-) Anyway, it works now, it seems. Thanks to all the people who help me on this, and a special thanks to Francois (BTW I won't publish the code since this problem is solved...) Christophe Bjørnar Nielsen wrote: I checked this and I am pretty sure it happens only on second time connections. When I first do a GET or POST, it always works. Just out of my head, here is som possible reasons that maybe can cause your problem. - The header you generate has wrong content length that tells the length of the body you send. - You don't provide a content length in your header, in that case the browser don't know that he has received all data untill you close the connection. - You don't call Connection.PostedDataReceived when all data is received inside PostedData-event. If you close the connection, then you should also indicate this happening in the header (Connection: Close, instead of Connection: Keep-Alive) Regards Bjørnar -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Multi user lockup problem under Linux (Kylix)
Hi Guys, I'm hoping that you can help me. I have a web server application which is compiled under Windows and Linux (common source). On the Windows platform I derive from TCustomWSocket and use Delphi 7 Professional. On the Linux platform, I derive from TIcsCustomSocket on use Kylix 3 Professional. The source code for the web server is totally common for both platforms, and uses conditional defines for the platform specific stuff. Under windows the web server works perfectly no matter how much load we put on it, but under Linux, as soon as we have more than one socket accessing the server at a time, the server appears to lockup and takes the CPU to 100%. There are obviously massive differences in the underlying architecture with the TCustomWSocket component being event (message) based, and the TIcsCustomSocket component being ... well thread based. It is noteworthy that under Linux, a single connection can perform a multitude of requests under HTTP/1.1 and connection keep-alive, and there don't appear to be problems there. I suspect that this has to do with threads not synchronizing correctly or something and thought I'd ask if anyone has seen this sort of thing and has some input that will benefit me. Regards Erich Kuba -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Assign event handler to manually created TStmpCli object
Dear all, I am writing a simple mail client in console application form. I manually created a TSmtpCli object for my purpose. The problem is that after I call the SmtpClient-Connect() method, the client fails to connect to the SMTP server. I referenced the MailSnd example and did set SmtpClient-Host, SmtpClient-Port properties as in MailSnd. Using MailSnd to connect and send mail to server does not have problem. I notice that the events SmtpClientDisplay and SmtpClientRequestDone in MailSnd will be triggered when response is received from SMTP server. I place similar event handlers in my program in an attempt to print message on the console window, but the events just will not be triggered. I assign the event handlers in the following way: SmtpClient = new TSmtpCli(NULL); if(SmtpClient != NULL) { SmtpClient-OnDisplay = SmtpClientDisplay; SmtpClient-OnRequestDone = SmtpClientRequestDone; : : } Is it the proper way to assign event handler? How can I trace where the problem is in failing to connect to SMTP server? Many thanks, Patrick Wong -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be