delphi,c++builder,indy,indy10,indy-9
A literal translation to C++Builder would look like this: ...... String __fastcall AddHeader(String S, String Header) { S = StringReplace(S, "\r\n\r\n", "\r\n" + Header + "\r\n\r\n", TReplaceFlags() << rfReplaceAll); return S; } void __fastcall TForm::IdMappedPortTCP1Execute(TIdContext *AContext) { String Mydata, NetData; if ((netstring(AContext).Pos("HTTP") != 0) || (netstring(AContext).Pos("GET") != 0)) { NetData...
When TIdMessage parses an email, by default it decodes transfer encodings (quoted printable, etc) to raw bytes and then charset-decodes those bytes to UTF-16 in memory. To avoid that, you would have to set TIdMessage::NoDecode to true before loading the email, but then you will not be able to use...
NetData is a property of TIdMappedPortContext, eg: TIdMappedPortContext(AContext).OutboundClient.IOHandler.Write(AddHeader(BytesToString(TIdMappedPortContext(AContext).NetData), 'Connection: Keep-Alive')); TIdMappedPortContext(AContext).OutboundClient.IOHandler.Write(StringReplace(BytesToString(TIdMappedPortContext(AContext).NetData), #13#10#13#10, #13#10 + 'Connection: Keep-Alive' + #13#10 + #13#10, [rfReplaceAll])); In the code you showed, your use of netbyte() and netstring() does make it seem like you are trying to account for the...
You do not need to use separate TIdUDPClient and TIdUDPServer on the same port. You can use TIdUDPServer by itself and let it handle both sending and receiving. No need to use a separate TIdUDPClient at all. Also, you are not using the Binding property correctly. When you read a...
delphi,redirect,indy,delphi-xe5,indy10
Client behavior for handling the HTTP 302 reply code is ambiguous, and often treated erroneously by various clients. This is well documented in various RFCs, including 2068 and 2616. The 303 reply code was created to resolve the ambiguity, but many clients still do not support 303 yet, and many...
delphi,http,openssl,indy,indy10
What could be the problem? The site appears operational to me. I could even connect with TLS 1.2. I failed when trying to connect with SSLv3, however. That's a good thing. Its may be a bug in the library. That is, its trying to connect with SSLv3, or its...
When I monitor the network traffic using "Microsoft Network Monitor 3.4", the file is only partially sent and none of the other data is sent. Are you sure the monitor is simply not displaying partial data in its UI? A packet sniffer like Wireshark would be more reliable (or...
HTML5 Section 4.10.22.7 alters how RFC 2388 applies to webform submissions: The parts of the generated multipart/form-data resource that correspond to non-file fields must not have a Content-Type header specified. Their names and values must be encoded using the character encoding selected above (field names in particular do not get...
You need to create the TStringList object that ConvertStreamToStrings() returns. Add this: Result := TStringList.Create; before the call to LoadFromStream(). Of course, you also need to Free() the returned TStringList when you don't need it anymore. Edit after comments Also, you need to reset the stream's Position to 0 before...
delphi,delphi-xe2,tcpclient,indy10,ttcpserver
I see problems with your client code. You are assigning TCPClient.OnConnected and TCPClient.OnDisconnected event handlers after calling TCPClient.Connect(). You should be assigning them before calling Connect(). you are assigning TCPClient.IOHandler.DefStringEncoding after sending all of your data. You should be setting it before sending any data. You are sending the .zip...
You are setting the top-level TIdMessage.ContentType to text/plain, which tells the reader to interpret the entire email as plain text. You need to set that property to multipart/mixed instead, then the reader will interpret the attachment: with IdMessage1 do begin ... ContentType := 'multipart/mixed'; end; I would also suggest you...
I fixed the problem I was having, by moving the write(msg) into the if statement checking if the buffer is not nil. with Client do begin Connect; while True do begin try if IOHandler.CheckForDataOnSource(1000) then begin WriteLn('Bytes available: ' IntToStr(IOHandler.InputBuffer.Size)); IOHandler.ReadBytes(buffer, IOHandler.InputBuffer.Size); end; except on e : exception do writeln(e.message);...
delphi,httpclient,http-status-code-403,indy10
The problem was with the UserAgent: function DoRequest(aVal: string): string; const DOMAIN = 'http://domain-location.com'; var request: TIdHTTP; urlRequest: string; begin request := TIdHTTP.Create(nil); try try request.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36'; urlRequest := DOMAIN + '?key=' + aVal; Result := request.Get(urlRequest); except on...
delphi,indy,delphi-2007,indy10
After further investigation I found that there is a new TCP_KEEPALIVE constant being declared in IdWinsock2.pas: {$EXTERNALSYM TCP_KEEPALIVE} TCP_KEEPALIVE = 3; This conflicts with the existing tcp_keepalive record, so that has been renamed to _tcp_keepalive. Updating the ka variable declared in TIdStackWindows.SetKeepAliveValues() to this new typename resolves the error. I...
delphi,udp,delphi-xe,indy10,hardware-interface
You need to set up the Bindings collection before you activate the server, not after: //udpserver.Active := True; binding := udpserver.Bindings.Add; binding.IP := '192.168.01.100'; binding.Port := 9652; udpserver.Active := True; // <-- move down here If the Bindings collection is empty when you activate the server, it will create a...
By default, Indy uses 7bit ASCII as its character encoding (for compatibility with various Internet protocols). To use a different character encoding, you need to either: set the IOHandler.DefStringEncoding property before doing any reading/writing. The string-based I/O methods will then use this encoding by default. // note: use TIdTextEncoding.UTF8 if...
delphi,c++builder,indy,indy10,c++builder-xe5
The final working code is: std::unique_ptr< TFileStream >fs(new TFileStream(path, fmOpenRead | fmShareDenyNone)); fs->Position = 0; __int64 size = fs->Size; AResponseInfo->ContentLength = size; AResponseInfo->ResponseNo = 200; AResponseInfo->WriteHeader(); AContext->Connection->IOHandler->Write(fs.get(), size); This allows the client to receive up to size bytes of the original file, even if the file is being written to...
You can derive a class from Indy's TIdSync or TIdNotify class and override the TIdSync.DoSynchronize() or TIdNotify.DoNotify() method to do what you need. Or, in recent Delphi versions, you can use the anonymous procedure version of the static TThread.Synchronize() or TThread.Queue() methods. Examples of both approaches have been posted many...
At this time, TIdSNMP only supports SNMPv1. Setting Trap->Version to 2 does not send a v2/v3 formatted trap, as the layout of the trap PDU is different between v1 and v2/v3. Support for newer SNMP versions is on Indy's todo list: Update TIdSNMP to support newer SNMP versions https://code.google.com/p/indyproject/issues/detail?id=139 http://indy.codeplex.com/workitem/19076...
delphi,delphi-2010,indy,indy10,amazon-mws
Found the problem: Indy (and Synapse too) adds the port number to the "Host" header line, and I had not realized that extra bit until I watched the headers more closely with Fiddler (thanks, @Graymatter!!!!). When I change the endpoint to be mws.amazonservices.com:443 (instead of just mws.amazonservices), then my signature...
I have a problem with function TIdIMAP4.ListSubscribedMailBoxes(AMailBoxList: TStrings): Boolean; with this implementation : Works fine for me when I try it using the latest SVN version of Indy. When I debug I see that the LastCmdResult.Text stringlist is empty, but the LastCmdResult.FormattedReply stringlist has all folders on my email...
The PeerIP alone is not unique enough to identify a client. Think of what happens when multiple clients running on one side of a router connect to the same server running on the other side of the router. The clients will have the same PeerIP (the router's IP) from the...
TStream is an abstract class. You must never instantiate it. Use a concrete class instead like, for instance, TMemoryStream. You'll also want to destroy the stream when you are finished with it, or it will leak. Do yourself a favour and set ReportMemoryLeaksOnShutdown to True, for instance in your .dpr...
It seems that the problem happens with Indy + SSL + Windows 8.1 The solution is simply to add: IdHTTP1->ReadTimeout = 30000; Problem solved!...
The RecvBufferSize has nothing to do with how many data is actually available for reading. The RecvBufferSize merely specifies the size that Indy uses when allocating internal buffers for reading raw data from the socket. Whatever raw data is actually read gets placed in the IOHandler.InputBuffer for later use by...
Without seeing the actual email data, it is difficult to say for sure exactly why the data is not where you expect it to be. But if the TIdMessage.IsMsgSinglePartMime is getting set to True then that means that either: TIdMessage.Encoding is meMIME but TIdMessage.MIMEBoundary.Count is 0, meaning there was no...
Indy already has a built-in framework for connecting any TCP client component through a proxy. You simply attach the desired proxy component to the client component, and then the client will automatically connect to the proxy and tell it where to connect to. And proxy components can be chained, if...
If TIdFTP.List() is not raising an exception, the FTP server is most likely returning a 450 reply code, which simply means "Requested file action not taken". TIdFTP.InternalGet() (which is used by TIdFTP.List(), TIdFTP.ExtListDir(), and TIdFTP.Get()) does not treat 450 as an error condition, as some servers (like Ericsson Switch FTP)...