indy

Global, thread safe, cookies manager with Indy

时间秒杀一切 提交于 2019-12-06 05:35:53
My Delphi 2010 app uploads stuff using multi-threading, uploaded data is POSTed to a PHP/web application which requires login, so I need to use a shared/global cookies manager (I'm using Indy10 Revision 4743 ) since TIdCookieManager is not thread-safe :( Also, server side, session id is automatically re-generated every 5 minutes, so I must keep both the global & local cookie managers in sync. My code looks like this: TUploadThread = class(TThread) // ... var GlobalCookieManager : TIdCookieManager; procedure TUploadThread.Upload(FileName : String); var IdHTTP : TIdHTTP; TheSSL :

sending mail but no message-id

∥☆過路亽.° 提交于 2019-12-06 04:05:34
I am getting interesting rejections from my clients mail server when sending a mail with indy-10's tidMessage component saying: 550 Rejected: Message does not contain a Message-ID I get this even when using indy's own demo app http://www.indyproject.org/DemoDownloads/Indy_10_MailClient.zip what do I do to fix this. thanks! TIdMessage in Indy 10 intentionally omits the 'Message-Id' header when encoding an email to a socket or TStream. You will have to use the TIdMessage.ExtraHeaders property, eg: IdMessage1.MsgId := ...'; IdMessage.ExtraHeaders.Values['Message-Id'] := IdMessage1.MsgId; EDIT: As

Measuring network traffic with Indy

主宰稳场 提交于 2019-12-06 03:55:55
问题 I'm using a TIdTCPCmdServer to handle all communication with client applications. I would like my server to log all kind of stuff including network traffic. Is there any easy or clever way to see how much bytes the TCPCmdServer actually received and sent? I can only think of code like ASender.SendReply; Inc (FTraffic, Sizeof (ASender.NormalReply.Code) + Sizeof (Char) * ASender.NormalReply.Text.Length)); which is extremely ugly in my opinion because these traffic updates would be spreaded out

Delphi & Indy & utf8

懵懂的女人 提交于 2019-12-06 01:08:04
i have a problem to access into websites whit utf8 charset, for example when i try to accesso at this www Click for example all utf8 characters are not correctly codified. This is my access routine: var Web : TIdHTTP; Sito : String; hIOHand : TIdSSLIOHandlerSocketOpenSSL; begin Url := TIdURI.URLEncode(Url); try Web := TIdHTTP.Create(nil); hIOHand := TIdSSLIOHandlerSocketOpenSSL.Create(nil); hIOHand.DefStringEncoding := IndyTextEncoding_UTF8; hIOHand.SSLOptions.SSLVersions := [sslvTLSv1,sslvTLSv1_1,sslvTLSv1_2,sslvSSLv2,sslvSSLv3,sslvSSLv23]; Web.IOHandler := hIOHand; Web.Request.CharSet :=

Read and save part of file stream via IdHTTP

限于喜欢 提交于 2019-12-05 22:33:40
I want to download a file from a HTTP server via a file stream and only read (and save to a file) the first few lines, say 100. After reading the first 100 lines the file stream must end: so I do NOT want to download or read the entire file. Below you can find what I have so far. The website is just an example. Can someone guide me in the right direction? const myURL = https://graphical.weather.gov/xml/DWMLgen/schema/latest_DWML.txt var fs: TMemoryStream; http: TIdHTTP; begin fs := TMemoryStream.Create; http := TIdHTTP.Create(nil); try fs.Position := 0; http.Get(myURL, fs); fs.SaveToFile('test

Sending message to gmail fails with “Start SSL negotiation command failed.” error

做~自己de王妃 提交于 2019-12-05 18:39:50
Tips i followed is found here . I do have libeay32.dll and ssleay32.dll in win32 folder. dfm file: object tidSMTP: TIdSMTP IOHandler = tidSMTP_SSL SASLMechanisms = <> UseTLS = utUseExplicitTLS end object tidSMTP_SSL: TIdSSLIOHandlerSocketOpenSSL Destination = 'smtp.gmail.com:587' Host = 'smtp.gmail.com' MaxLineAction = maException Port = 587 DefaultPort = 0 SSLOptions.Mode = sslmUnassigned SSLOptions.VerifyMode = [] SSLOptions.VerifyDepth = 0 end and Send button click event: procedure TForm1.btnSendClick(Sender: TObject); var mes:TIdMessage; fromAddress:TIdEmailAddressItem; toAddress

Delphi - Indy - saving GMail draft

泪湿孤枕 提交于 2019-12-05 06:56:02
I've been using Indy under Delphi to send message via a gmail account, using the TIdSMTP and TIdMessage components. This works absolutely fine. However, my client has requested to save the message to the DRAFTS folder to allow him to make changes to the (programatically created) message before actually sending it. GMail API is supposed to support this, but the provided examples are not in Delphi/Indy formats... I'm looking for minimal programming changes so I'd like to know if it is possible in the Indy components too? TIdMessage allows for a "mfDraft" flag, but this doesn't prevent the

Can I check the Indy version installed?

别说谁变了你拦得住时间么 提交于 2019-12-05 05:46:30
I need to use the latest Indy component library version. Can I get the library version by some source code command or any other trick to make sure I'm using the correct lib. I know I'm using the indy....160.bpl - this is what my Delphi XE2 says while moving the mouse over the component bar. The latest INDY lib I take from Fulgan Indy How to get version of Indy by using an Indy component at runtime ? As @Remy pointed out in his comment, you can get the Indy version from any Indy component by using the Version property. Here's a sample using TIdHTTP component: procedure TForm1.Button1Click

Resume HTTP Post/upload with Indy

我们两清 提交于 2019-12-05 04:52:10
问题 I'm trying to resume an upload using indy (HTTP Post), the code looks like this (using Delphi 2010, Indy 10.4736): IdHttp.Head('http://localhost/_tests/resume/large-file.bin'); ByteRange := IdHttp.Response.ContentLength + 1; // Attach the file to post/upload Stream := TIdMultipartFormDataStream.Create; with Stream.AddFile('upload_file', 'D:\large-file.bin', 'application/octet-stream') do begin HeaderCharset := 'utf-8'; HeaderEncoding := '8'; end; // with with IdHTTP do begin IOHandler

How to optimize upload routine using Delphi 2010?

蓝咒 提交于 2019-12-05 04:43:38
My yet to be released Delphi 2010 application allows users to upload their files to my servers. Right now I'm using HTTPS POST to send the files, the (simplified) algorithm is basically: Split File into "slices" (256KB each) For each slice, POST it to server ie. for a 1MB file: --> Get Slice #1 (256KB) --> Upload Slice #1 using TidHTTP.Post() --> Get Slice #2 (256KB) --> Upload Slice #2 using TidHTTP.Post() --> Get Slice #3 (256KB) --> Upload Slice #3 using TidHTTP.Post() --> Get Slice #4 (256KB) --> Upload Slice #4 using TidHTTP.Post() I'm using Indy 10 . I (ab)used my profiler over and over