indy

How to handle TIdHTTPServer with TIdMultiPartFormDataStream

孤街浪徒 提交于 2019-12-14 01:12:48
问题 Hi i need help on how to retrieved the parameters and data using IdHttpServer from indy. many of my application uses TIdMultiPartFormDataStream to send data over the php. I would like to use the TIdHTTPServer to verify parameters for some reason and forward the request to its destination. i created a short example for you to see. uses IdContext, IdMultipartFormData; // Server Side------------------------------------------------ IdHTTPServer1.Defaultport := 88; IdHTTPServer1.active := True;

TIdHTTP in Indy 10

耗尽温柔 提交于 2019-12-13 16:34:46
问题 I used to use Indy back in the Delphi 6 days, and I am playing with Indy 10 now. What I want to do is incredibly simple, but I don't see a simple way of doing it, so I must be missing something. What I want to do is something like this: Here is the actual code I am using: procedure TForm1.btnGetURLClick(Sender: TObject); begin moHeader.Lines.Clear; moBody.Lines.Clear; try moBody.text := IdHttp1.Get(edURL.text); finally end; end; When the request is complete, the http_result should contain the

Socket Error #113 No route to host on Android

三世轮回 提交于 2019-12-13 15:17:35
问题 In a Delphi XE6 FireMonkey app, when I press the button, I get the following error on Android: Socket Error #113 No route to host procedure TForm1.Button1Click(Sender: TObject); var Intent: JIntent; datosPost: TIdMultiPartFormDataStream; mRespuestaPost: String; begin try datosPost := TIdMultiPartFormDataStream.Create; datosPost.AddFormField('usuario', txtUser.Text); datosPost.AddFormField('password', txtPass.Text); mRespuestaPost := DataModule2.IdHTTP.Post ('http://X.X.X.X/CGLB/ac.php',

How to send Cyrillic data with indy10 Delphi

≯℡__Kan透↙ 提交于 2019-12-13 14:27:12
问题 When I send some Cyrillic text in the web site that text is displayed with "?????????".... Here is my sending function: http := TIDHttp.Create(nil); http.HandleRedirects := true; http.ReadTimeout := 5000; http.Request.ContentType:='multipart/form-data'; param:=TIdMultiPartFormDataStream.Create; param.AddFormField('adtitle','Текст на кирилица'); param.AddFormField('area','Текст явергсдфсдфадфас'); http.Post('http://www.example.com/',param); 回答1: Try like this: param.AddFormField('adtitle',

Accessing JSON data after Indy POST

萝らか妹 提交于 2019-12-13 14:26:15
问题 I am struggling to know how to access the response to an Indy POST request. I post the data either as JSON or paramstring. My code when using JSON is as follows. params := TStringList.Create; try params.Text := '{' + format ('"client_secret":"%s",', [FilesFrm.ClientSecret]) + format ('"client_id":"%s",', [FilesFrm.ClientId]) + '"grant_type":"authorization_code",' + '"redirect_uri":"http://localhost:8080",' + format ('"code":"%s"', [fCode]) + '}'; idLogFile1.Active := true; // Make sure it

Cannot use secure SMTP connection to Office365 with Delphi 2010 and Indy 10.5.5

為{幸葍}努か 提交于 2019-12-13 14:05:13
问题 Can anyone diagnose my failure to connect to smtp.office365.com using Delphi 2010 and Indy 10.5.5? I have read the code examples provided by Indy expert Remy Lebeau in this question: Using INDY 10 SMTP with Office365. I have taken each of the two alternate code samples (one using AuthType satDefault and the other satSASL ) from that question and cut-and-pasted them into a console application. In each case get the following error when run: EIdOSSLUnderlyingCryptoError: Error connecting with

Getting XML from response stream using Indy's IDTCPClient [closed]

▼魔方 西西 提交于 2019-12-13 11:25:13
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . This question is in direct relation to: Getting HTML from response stream using Indy's IDTCPClient I just need a version of get function to retrieve XML function TMyConnector.GETXML(aRawHeader: String): String; Using a idHTTP component, I could do the following HTTP.Request.ContentType := 'text/xml'; The header

How to handle TIdHTTP fatal network errors without interrupting thread's execution?

对着背影说爱祢 提交于 2019-12-13 05:51:50
问题 I'd like to elaborate on how to properly handle fatal network exceptions raised by TIdHTTP inside TThread's Execute procedure. My app runs a while..do loop inside the Execute procedure. Each loop makes a TIdHTTP.Get() call. The exceptions are handled at the loop level. There is also an upper level handler of on E: Exception do (level of Execute ). The scenario assumes a fatal network error during active network operations (i.e. adapter outage, "connection reset by peer", etc.). 10 threads are

Download CSV in Delphi 5 with Indy

青春壹個敷衍的年華 提交于 2019-12-13 04:51:14
问题 I know there's alot of Indy threads but I can't get one to match my case. I have been given a URL with a username and password form. this then actions to a URL/reports.php on which there are multiple hyperlinks. Each of these links will direct to a page with URL variables e.g. reports.php?report=variablename where a download will immediately start. My thinking so far: procedure TForm1.PostData(Sender: TObject); var paramList:TStringList; url,text:string; // IdHTTP1: TIdHTTP;

How to blacklist an IP on TIdHTTPServer

不问归期 提交于 2019-12-13 04:39:26
问题 In a TIdHTTPServer component, I'd like to enable a blacklist of IP addresses to block. I'd like to make sure this is on the lowest level possible to prevent any unnecessary data streaming in from a blacklisted client. How should I intercept this server component to block an IP on the lowest level possible? This applies to both IP v4 and v6 回答1: On Indy 9, there was an event for refusing a connection before it was actually accepted. On Indy 10, it's still not implemented. If you look at