فهرست منبع

Indy immer neu erstellen + OpenSSL Update

Simon Grossenbacher 7 سال پیش
والد
کامیت
dd938c3fb6
9فایلهای تغییر یافته به همراه115 افزوده شده و 157 حذف شده
  1. 1 1
      Example Config.rdproj
  2. BIN
      RESTDebugger.exe
  3. BIN
      libeay32.dll
  4. 10 11
      prj/RESTDebugger.dproj
  5. BIN
      prj/RESTDebugger.res
  6. 6 6
      prj/RESTDebugger.stat
  7. 2 46
      src/_frmMain.dfm
  8. 96 93
      src/_frmMain.pas
  9. BIN
      ssleay32.dll

+ 1 - 1
Example Config.rdproj

@@ -1,7 +1,7 @@
 {
 	"Presets": {
 		"Presets": "GET: Simple GET\r\nGET: GET Extra Headers\r\nGET: Use Basic Auth Example\r\nGET: Example URL Parameters\r\nPOST: Json Post Data\r\nDELETE: Delete Data\r\nPUT: Json Put Data\r\nPATCH: Json Patch Data\r\n",
-		"LastUsed": 0
+		"LastUsed": 4
 	},
 	"Preset_0": {
 		"BaseURL": "https://httpbin.org/get",

BIN
RESTDebugger.exe


BIN
libeay32.dll


+ 10 - 11
prj/RESTDebugger.dproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{EAAEC73B-CF16-46C3-A598-65374DE332E9}</ProjectGuid>
-        <ProjectVersion>18.3</ProjectVersion>
+        <ProjectVersion>18.4</ProjectVersion>
         <FrameworkType>VCL</FrameworkType>
         <MainSource>RESTDebugger.dpr</MainSource>
         <Base>True</Base>
@@ -86,9 +86,9 @@
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
         <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
         <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
-        <VerInfo_Keys>FileVersion=1.1.6.25;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
-        <VerInfo_Release>6</VerInfo_Release>
-        <VerInfo_Build>25</VerInfo_Build>
+        <VerInfo_Keys>FileVersion=1.1.7.30;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+        <VerInfo_Release>7</VerInfo_Release>
+        <VerInfo_Build>30</VerInfo_Build>
         <Icon_MainIcon>RESTDebugger_Icon.ico</Icon_MainIcon>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
@@ -115,16 +115,15 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
         <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Keys>FileVersion=1.1.6.25;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
-        <VerInfo_Build>25</VerInfo_Build>
-        <VerInfo_Release>6</VerInfo_Release>
+        <VerInfo_Keys>FileVersion=1.1.7.30;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+        <VerInfo_Build>30</VerInfo_Build>
+        <VerInfo_Release>7</VerInfo_Release>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <AppEnableHighDPI>true</AppEnableHighDPI>
         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
         <Icon_MainIcon>RESTDebugger_Icon.ico</Icon_MainIcon>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
         <VerInfo_MinorVer>1</VerInfo_MinorVer>
-        <Debugger_RunParams>/update</Debugger_RunParams>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2)'!=''">
         <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
@@ -141,9 +140,9 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
         <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Keys>FileVersion=1.1.6.25;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
-        <VerInfo_Release>6</VerInfo_Release>
-        <VerInfo_Build>25</VerInfo_Build>
+        <VerInfo_Keys>FileVersion=1.1.7.30;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+        <VerInfo_Release>7</VerInfo_Release>
+        <VerInfo_Build>30</VerInfo_Build>
         <AppEnableHighDPI>true</AppEnableHighDPI>
         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
         <VerInfo_Locale>1033</VerInfo_Locale>

BIN
prj/RESTDebugger.res


+ 6 - 6
prj/RESTDebugger.stat

@@ -1,10 +1,10 @@
 [Stats]
-EditorSecs=19625
-DesignerSecs=5709
-InspectorSecs=3051
-CompileSecs=1006032
-OtherSecs=5049
+EditorSecs=20546
+DesignerSecs=5703
+InspectorSecs=3063
+CompileSecs=1060174
+OtherSecs=5211
 StartTime=27.10.2016 18:27:37
 RealKeys=0
 EffectiveKeys=0
-DebugSecs=14411
+DebugSecs=14658

+ 2 - 46
src/_frmMain.dfm

@@ -134,10 +134,6 @@ object frmMain: TfrmMain
     object tabContent: TcxTabSheet
       Caption = 'Response Content'
       ImageIndex = 0
-      ExplicitLeft = 0
-      ExplicitTop = 0
-      ExplicitWidth = 0
-      ExplicitHeight = 0
       object EditorContent: TSynEdit
         Left = 0
         Top = 0
@@ -170,10 +166,6 @@ object frmMain: TfrmMain
     object tabHeaders: TcxTabSheet
       Caption = 'Response Headers'
       ImageIndex = 1
-      ExplicitLeft = 0
-      ExplicitTop = 0
-      ExplicitWidth = 0
-      ExplicitHeight = 0
       object EditorResponseHeaders: TSynEdit
         Left = 0
         Top = 0
@@ -354,10 +346,6 @@ object frmMain: TfrmMain
       object tabURLParams: TcxTabSheet
         Caption = 'URL Parameters'
         ImageIndex = 0
-        ExplicitLeft = 0
-        ExplicitTop = 0
-        ExplicitWidth = 0
-        ExplicitHeight = 0
         object Panel3: TPanel
           Left = 0
           Top = 0
@@ -408,10 +396,6 @@ object frmMain: TfrmMain
       object cxTabSheet2: TcxTabSheet
         Caption = 'Extra Headers'
         ImageIndex = 1
-        ExplicitLeft = 0
-        ExplicitTop = 0
-        ExplicitWidth = 0
-        ExplicitHeight = 0
         object Panel4: TPanel
           Left = 0
           Top = 0
@@ -461,10 +445,6 @@ object frmMain: TfrmMain
       object cxTabSheet3: TcxTabSheet
         Caption = 'Authentication'
         ImageIndex = 3
-        ExplicitLeft = 0
-        ExplicitTop = 0
-        ExplicitWidth = 0
-        ExplicitHeight = 0
         object Label9: TLabel
           Left = 15
           Top = 47
@@ -501,10 +481,6 @@ object frmMain: TfrmMain
       object tabPostData: TcxTabSheet
         Caption = 'Post Data'
         ImageIndex = 2
-        ExplicitLeft = 0
-        ExplicitTop = 0
-        ExplicitWidth = 0
-        ExplicitHeight = 0
         object Panel5: TPanel
           Left = 0
           Top = 0
@@ -609,26 +585,6 @@ object frmMain: TfrmMain
     Left = 380
     Top = 35
   end
-  object HTTP: TIdHTTP
-    IOHandler = SSLIOHandlerSocketOpenSSL
-    AllowCookies = True
-    HandleRedirects = True
-    ProxyParams.BasicAuthentication = False
-    ProxyParams.ProxyPort = 0
-    Request.CharSet = 'utf-8'
-    Request.ContentLength = -1
-    Request.ContentRangeEnd = -1
-    Request.ContentRangeStart = -1
-    Request.ContentRangeInstanceLength = -1
-    Request.Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
-    Request.BasicAuthentication = False
-    Request.UserAgent = 'Simnet REST Debugger'
-    Request.Ranges.Units = 'bytes'
-    Request.Ranges = <>
-    HTTPOptions = []
-    Left = 75
-    Top = 65
-  end
   object SSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL
     MaxLineAction = maException
     Port = 0
@@ -867,9 +823,9 @@ object frmMain: TfrmMain
       OnClick = pmnuCompactXMLClick
     end
     object pmnuBiggerEditor: TdxBarButton
-      Caption = 'Bigger Editor'
+      Caption = 'Large Editor'
       Category = 0
-      Hint = 'Bigger Editor'
+      Hint = 'Large Editor'
       Visible = ivAlways
       ImageIndex = 18
       ShortCut = 122

+ 96 - 93
src/_frmMain.pas

@@ -28,7 +28,6 @@ type
     dxSkinController: TdxSkinController;
     Label1: TLabel;
     Image: TImage;
-    HTTP: TIdHTTP;
     SSLIOHandlerSocketOpenSSL: TIdSSLIOHandlerSocketOpenSSL;
     dxStatusBar: TdxStatusBar;
     dxBarManager: TdxBarManager;
@@ -179,6 +178,7 @@ type
     FTempProjectFile: string;
     FRoamingSavePath: string;
     FSearchFromCaret: Boolean;
+    FHTTP: TIdHTTP;
     function GetTempProjectFile: string;
     function GetAppVersion: string;
     procedure UpdateFullURL;
@@ -456,7 +456,7 @@ begin
             UpdateFile.Add('timeout 1');
             UpdateFile.Add('taskkill /F /IM RESTDebugger.exe');
             UpdateFile.Add('"%~dp0Update.exe" -o"' + ExtractFilePath(ParamStr(0)) + '" -y');
-            UpdateFile.Add('start "" "' + ParamStr(0) + '" "/updated"');
+            UpdateFile.Add('start "" "' + ParamStr(0) + '"');
             UpdateFile.Add('del "%~dp0Update.exe"');
             UpdateFile.Add('del "%~dp0Update.cmd"');
             UpdateFile.SaveToFile(IncludeTrailingPathDelimiter(TPath.GetTempPath) + 'Update.cmd');
@@ -627,13 +627,13 @@ var
 begin
   try
     case AMethodType of
-      mtGET: dmy := HTTP.Get(edtFullURL.Text);
-      mtDELETE: dmy := HTTP.Delete(edtFullURL.Text);
+      mtGET: dmy := FHTTP.Get(edtFullURL.Text);
+      mtDELETE: dmy := FHTTP.Delete(edtFullURL.Text);
     end;
 
-    if HTTP.ResponseCode.ToString[1] <> '2' then
+    if FHTTP.ResponseCode.ToString[1] <> '2' then
     begin
-      ShowError(HTTP.ResponseText);
+      ShowError(FHTTP.ResponseText);
     end;
   except
     on E: Exception do
@@ -645,7 +645,7 @@ begin
   ActiveEditor := EditorContent;
   UpdateEditor(dmy);
   ActiveEditor := EditorResponseHeaders;
-  UpdateEditor(HTTP.Response.RawHeaders.Text);
+  UpdateEditor(FHTTP.Response.RawHeaders.Text);
 end;
 
 procedure TfrmMain.DoPOSTRequest(const AMethodType: TMethodType);
@@ -655,17 +655,17 @@ var
 begin
   strstream := TStringStream.Create(EditorPostData.Lines.Text, TEncoding.UTF8);
   try
-    HTTP.Request.ContentType := comboPostContentType.Text;
+    FHTTP.Request.ContentType := comboPostContentType.Text;
     try
       case AMethodType of
-        mtPOST: dmy := HTTP.Post(edtFullURL.Text, strstream);
-        mtPATCH: dmy := HTTP.Patch(edtFullURL.Text, strstream);
-        mtPUT: dmy := HTTP.Put(edtFullURL.Text, strstream);
+        mtPOST: dmy := FHTTP.Post(edtFullURL.Text, strstream);
+        mtPATCH: dmy := FHTTP.Patch(edtFullURL.Text, strstream);
+        mtPUT: dmy := FHTTP.Put(edtFullURL.Text, strstream);
       end;
 
-      if HTTP.ResponseCode.ToString[1] <> '2' then
+      if FHTTP.ResponseCode.ToString[1] <> '2' then
       begin
-        ShowError(HTTP.ResponseText);
+        ShowError(FHTTP.ResponseText);
       end;
     except
       on E: Exception do
@@ -680,7 +680,7 @@ begin
   ActiveEditor := EditorContent;
   UpdateEditor(dmy);
   ActiveEditor := EditorResponseHeaders;
-  UpdateEditor(HTTP.Response.RawHeaders.Text);
+  UpdateEditor(FHTTP.Response.RawHeaders.Text);
 end;
 
 procedure TfrmMain.DoSearchReplaceText(AReplace, ABackwards: Boolean);
@@ -941,8 +941,6 @@ begin
 
   ActiveEditor := nil;
 
-  HTTP.Request.UserAgent := 'Simnet REST Debugger/' + GetAppVersion;
-
   if (not MainConfig.ReadBool('Main', 'FirstStartShown')) and (FileExists(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + 'Example Config.rdproj')) then
   begin
     FActiveProject := IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + 'Example Config.rdproj';
@@ -952,7 +950,7 @@ begin
   end
   else
   begin
-    if (ParamStr(1) <> '') and not (LowerCase(ParamStr(1)) = '/updated') then
+    if (ParamStr(1) <> '') then
     begin
       FActiveProject := ParamStr(1);
       FIsTempProjectLoaded := False;
@@ -1049,11 +1047,6 @@ begin
 
 
   CheckForUpdate;
-
-  if LowerCase(ParamStr(1)) = '/updated' then
-  begin
-    //ShowMessage('updated');
-  end;
 end;
 
 function TfrmMain.GetAppVersion: string;
@@ -1288,84 +1281,94 @@ procedure TfrmMain.Run;
 var
   tick: Cardinal;
 begin
-  EditorContent.Lines.Clear;
-  EditorResponseHeaders.Lines.Clear;
-
-  Screen.Cursor := crHourGlass;
-  tick := GetTickCount;
+  FHTTP := TIdHTTP.Create(nil);
+  FHTTP.IOHandler := SSLIOHandlerSocketOpenSSL;
+  FHTTP.HTTPOptions := [];
+  FHTTP.HandleRedirects := True;
+  FHTTP.AllowCookies := True;
+  FHTTP.Request.UserAgent := 'Simnet REST Debugger/' + GetAppVersion;
   try
-    HTTP.Request.CustomHeaders.Clear;
-    HTTP.Request.CustomHeaders.AddStrings(EditorExtraHeaders.Lines);
+    EditorContent.Lines.Clear;
+    EditorResponseHeaders.Lines.Clear;
 
-    if chkUseBasicAuth.Checked then
-    begin
-      HTTP.Request.Username := edtAuthUsername.Text;
-      HTTP.Request.Password := edtAuthPassword.Text;
-      HTTP.Request.BasicAuthentication := True;
-    end
-    else
-    begin
-      HTTP.Request.BasicAuthentication := False;
-      HTTP.Request.Username := '';
-      HTTP.Request.Password := '';
-    end;
+    Screen.Cursor := crHourGlass;
+    tick := GetTickCount;
+    try
+      FHTTP.Request.CustomHeaders.Clear;
+      FHTTP.Request.CustomHeaders.AddStrings(EditorExtraHeaders.Lines);
 
-    if comboMethod.ItemIndex = 0 then
-    begin
-      // GET
-      DoGETRequest(mtGET);
-    end
-    else
-    if comboMethod.ItemIndex = 1 then
-    begin
-      // POST
-      DoPOSTRequest(mtPOST);
-    end
-    else
-    if comboMethod.ItemIndex = 2 then
-    begin
-      // PATCH
-      DoPOSTRequest(mtPATCH);
-    end
-    else
-    if comboMethod.ItemIndex = 3 then
-    begin
-      // PUT
-      DoPOSTRequest(mtPUT);
-    end
-    else
-    if comboMethod.ItemIndex = 4 then
-    begin
-      // DELETE
-      DoGETRequest(mtDELETE);
-    end;
-  finally
+      if chkUseBasicAuth.Checked then
+      begin
+        FHTTP.Request.Username := edtAuthUsername.Text;
+        FHTTP.Request.Password := edtAuthPassword.Text;
+        FHTTP.Request.BasicAuthentication := True;
+      end
+      else
+      begin
+        FHTTP.Request.BasicAuthentication := False;
+        FHTTP.Request.Username := '';
+        FHTTP.Request.Password := '';
+      end;
 
-    if Pos('application/json', HTTP.Response.ContentType) > 0 then
-    begin
-      EditorContent.Highlighter := SynJSONSyn;
-    end
-    else
-    if Pos('text/xml', HTTP.Response.ContentType) > 0 then
-    begin
-      EditorContent.Highlighter := SynXMLSyn;
-    end
-    else
-    if Pos('text/html', HTTP.Response.ContentType) > 0 then
-    begin
-      EditorContent.Highlighter := SynHTMLSyn;
-    end
-    else
-    begin
-      EditorContent.Highlighter := nil;
-    end;
+      if comboMethod.ItemIndex = 0 then
+      begin
+        // GET
+        DoGETRequest(mtGET);
+      end
+      else
+      if comboMethod.ItemIndex = 1 then
+      begin
+        // POST
+        DoPOSTRequest(mtPOST);
+      end
+      else
+      if comboMethod.ItemIndex = 2 then
+      begin
+        // PATCH
+        DoPOSTRequest(mtPATCH);
+      end
+      else
+      if comboMethod.ItemIndex = 3 then
+      begin
+        // PUT
+        DoPOSTRequest(mtPUT);
+      end
+      else
+      if comboMethod.ItemIndex = 4 then
+      begin
+        // DELETE
+        DoGETRequest(mtDELETE);
+      end;
+    finally
 
-    EditorContent.SetFocus;
+      if Pos('application/json', FHTTP.Response.ContentType) > 0 then
+      begin
+        EditorContent.Highlighter := SynJSONSyn;
+      end
+      else
+      if Pos('text/xml', FHTTP.Response.ContentType) > 0 then
+      begin
+        EditorContent.Highlighter := SynXMLSyn;
+      end
+      else
+      if Pos('text/html', FHTTP.Response.ContentType) > 0 then
+      begin
+        EditorContent.Highlighter := SynHTMLSyn;
+      end
+      else
+      begin
+        EditorContent.Highlighter := nil;
+      end;
 
+      EditorContent.SetFocus;
 
-    dxStatusBar.Panels[1].Text := FormatFloat('Response Time: 0, ms', GetTickCount - tick);
-    dxStatusBar.Panels[2].Text := 'Response Code: ' + HTTP.ResponseCode.ToString;
-    Screen.Cursor := crDefault;
+
+      dxStatusBar.Panels[1].Text := FormatFloat('Response Time: 0, ms', GetTickCount - tick);
+      dxStatusBar.Panels[2].Text := 'Response Code: ' + FHTTP.ResponseCode.ToString;
+      Screen.Cursor := crDefault;
+    end;
+  finally
+    FHTTP.Free;
   end;
 end;
 

BIN
ssleay32.dll