Jump to content

baka0815

Members
  • Content Count

    39
  • Joined

  • Last visited

Community Reputation

11 Good

About baka0815

  • Birthday June 21

Technical Information

  • Delphi-Version
    Delphi 11 Alexandria

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. baka0815

    TIdHTTPWebBrokerBridge: Require TLS

    That's exactly what I'm doing with the implementation of OnQuerySSLPort(). if AContext.Connection.IOHandler is TIdSSLIOHandlerSocketBase then begin TIdSSLIOHandlerSocketBase(AContext.Connection.IOHandler).PassThrough := not DoQuerySSLPort(AContext.Connection.Socket.Binding.Port); end; inherited DoConnect(AContext); This is the code where DoQuerySSLPort calls the event and sets it's Result to True, therefor setting PassThrough. When I then try to connect via http://... (as said earlier https:// works flawlessly!) the exception raised is error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number The log from Postman is just Error: socket hang up The reply from curl is * Trying [fe80::64b3:3bf5:dfb6:3b7c]:8080... * Connected to server (fe80::64b3:3bf5:dfb6:3b7c) port 8080 > GET / HTTP/1.1 > Host: server:8080 > User-Agent: curl/8.4.0 > Accept: */* > * Empty reply from server * Closing connection curl: (52) Empty reply from server But what I would like to get is either a redirect to https or at least deliver some error message to the client to know what's wrong.
  2. baka0815

    TIdHTTPWebBrokerBridge: Require TLS

    At first: I searched the forum but couldn't find a topic matching my case, however my search-fu might be lacking, so please send me to the right place, if this was asked before. Thanks! I'm using a TIdHTTPWebBrokerBridge to serve incoming connections and that works flawlessly, with and without TLS (<= 1.2). However, if TLS is activated, I want to force the usage of TLS. What I'm currently doing is to implement OnQuerySSLPort(APort: TIdPort; var VUseSSL: Boolean) ans set VUseSLL to True, so SSL/TLS is forced and connections without TLS are not possible. But when I try to connect to the server without TLS (http://localhost:8080) I'm getting (via Bruno) Error invoking remote method 'send-http-request': TypeError: Cannot read properties of undefined (reading 'data') or "connection reset" via Firefox. When debugging I see that an exception is raised in procedure TIdSSLSocket.Accept(const pHandle: TIdStackSocketHandle); EIdOSSLAcceptError.RaiseException(fSSL, error, RSSSLAcceptError); How am I supposed to implement a redirect to the correct HTTPS-URL (or raise an error that TLS is required or something along those lines=?
  3. baka0815

    TLS v1.3

    Wouldn't that be something that could be automated in the CI of the Indy project (the creation of the cmd, without the txt file I mean)?
  4. baka0815

    Problem indent with inline var inside try/finally

    Does this also apply to inline variables inside begin/end blocks or only to try..except/finally blocks?
  5. baka0815

    Testers needed for GExperts Instant Grep expert

    So, something like this? Filename.pas | if (True) then Line 1234 | DoSomething() | else -------------+--------------------------- Filename.pas | // Comment Line 4567 | DoSomething(); |
  6. baka0815

    GExperts Favorites as WP-Plugin

    Sorry, no rush. Enjoy your vacation! It's not time-critical 😉
  7. baka0815

    GExperts Favorites as WP-Plugin

    @dummzeuchI would like to have your input on the patch to move the "Root" folder variable from the global space as a private field to the form (as it's only used there), to continue working on this.
  8. baka0815

    GExperts Favorites as WP-Plugin

    Thanks for the clarification, I'll check that! I opened a new ticket on sourceforge (wasn't sure if bug or feature, so I went for feature) to remove the global "Root: TGXFolder" variable: https://sourceforge.net/p/gexperts/feature-requests/170/ That's the reason for the access violation in my previous tests as the tree of the first created menu (the main menu "configure" form) still holds references to now freed objects (thanks to the new created form for the plugin). And as you mentioned, there are 2 more places creating the form, which would also recreate the root-tree and therefore clearing previous references.
  9. baka0815

    GExperts Favorites as WP-Plugin

    I don't understand your example, I'm afraid. The timer stops as soon as the plugin can be registered - not added to the welcome page. Or is the "WelcomePagePluginService" only available if the welcome page itself is active? So without WelcomePage there won't be the service? The form is only created when the CreateView method is called. And that's only the case if the plugin is not only registered, but also added to the welcome page. To your list of bugs I would also add that ".OnSettingsChanged := HandleOnSettingsChanged;" is not always encapsulated in {$IFDEF GX_VER150_up} if I see that correctly: Inside procedure TFavoriteFilesExpert.AfterIDEInitialized; Inside function TFavoriteFilesExpert.TryGetRootFolder(out _Folder: TGXFolder): Boolean;
  10. baka0815

    GExperts Favorites as WP-Plugin

    Thanks for the feedback! The logic is Check if we can register the welcome page plugin if not, then try again later (return to 1 in some seconds) if yes, register the plugin If I would create different methods, that would duplicate some code: procedure RegisterWelcomePage; // <-- entry point, check if WelcomePagePluginService is assigned, if yes call DoRegisterPlugin, if not, create timer procedure RegisterWelcomePageTimer(Sender: TObject); // Timer method which checks if WelcomePagePluginService is assigned if yes destroy timer and call DoRegisterPlugin, if not, do nothing (wait for next timer event) procedure DoRegisterPlugin; // perform the registration of the plugin Or RegisterWelcpomePageTimer(Sender: TObject) calls RegisterWelcomePage(), but then that method would need to check if the timer is already created, which is also a bit confusing. Or "RegisterWelcomePage" would always only create the timer and the timer would do the rest, as it's almost always the case that the plugin is not ready at that point. Then we wouldn't need the DoRegisterPlugin method. What's the problem of another instance of the form? The comment is correct, I changed it to // This is a bit hacky! // We're creating the form of the favorite files here and change the parents // of the elements, that we need in our frame. // That way the logic of the form (events etc.) can be used and does not // need to be duplicated here. I change the parent of the Panel pnlFiles, that hosts both elements, the listview and the fileview. This shouldn't create a problem, as changing the parent of one control removes this control from the current owner. From Vcl.Controls, procedure TControl.SetParent(AParent: TWinControl): if FParent <> nil then FParent.RemoveControl(Self); I tried that and it is working, however only for the current session. If you add a new file using the plugin, it's also directly visible in the main menu. But it's currently not saved to the configuration, so it's lost after a restart of the IDE. The plugin itself should be read-only and not allow any modifications to the favorites, I think. What's your opinion on this? Changing the view to only display while there are more than one entry would (in the current implementation) need the favorites form to have a separate mode of operation, or I would need to check if there are more than one entry in the treeview before changing the parent. Maybe I should reimplement the loading of the options logic instead of recreating the favorites form? Also using the configure-option currently raises an exception when the plugin is active: [01F027FC]{rtl280.bpl } System.@UStrAsg (Line 26918, "System.pas" + 3) + $0 [1FF1895B]{CnWizards_D110A.DLL} Unbekannte Funktion bei __dbk_fcall_wrapper + $66C43 [785AC793]{vcl280.bpl } Vcl.ComCtrls.TListItem.SetCaption (Line 17509, "Vcl.ComCtrls.pas" + 3) + $5 [239FEE87]{GExpertsRS110.dll} GX_FavFiles.TfmFavFiles.FileToListItem (Line 2045, "GX_FavFiles.pas" + 1) + $9 [239FA16C]{GExpertsRS110.dll} GX_FavFiles.TfmFavFiles.tvFoldersChange (Line 635, "GX_FavFiles.pas" + 15) + $9 [7859E35A]{vcl280.bpl } Vcl.ComCtrls.TTreeNode.GetSelected (Line 9297, "Vcl.ComCtrls.pas" + 0) + $2 Edit: the reason for the exception seems to be the global root-node, which gets cleared and repopulated in TfmFavFiles.LoadEntries. After the clearing the references to the objects in the tree are no longer valid, the folders freed and therefore the exception. So there mustn't be multiple instances of the TfmFavFiles form! That should be noted somewhere! It looks like I need to replicate the loading logic of the elements in a different way. Did that. However, when I change the code to only need the options (I don't need the expert in my current implementation) I could move the plugin logic to it's own unit. That would make it easier do en-/disable it for older Delphi versions. But I await your comments on 5 and 6 on that.
  11. baka0815

    GExperts Favorites as WP-Plugin

    Okay, here is the patch. I hope it applies cleanly, as I removed some commented lines which I currently have in my code for testing purposes. Favourites_as_WPPlugin.patch
  12. baka0815

    GExperts Favorites as WP-Plugin

    @dummzeuchwhat I would also like to have input in is, if the way I change the parent is okay, or if I should rebuild the panels for the component (I would then just create a tree on the left and the files-panel on the right - or should I include the files in the tree?). I changed the above code you mentioned to the following, because I would like to have the clarity of disabling the timer as soon as possible (and not just implicitly by destroying it). if (Assigned(FPluginTimer)) then begin FPluginTimer.Enabled := False; FreeAndNil(FPluginTimer); end;
  13. baka0815

    GExperts Favorites as WP-Plugin

    Yes, I'm aware of the necessary IFDEFs, I should've mentioned them. The ToolsAPI.WelcomePage is only available in Delphi 11+. I would also love to remove the timer, however I don't know of a way to register the plugin at the correct time. Creating the plugin as a BPL seems to work, but I would like to have it included in the GExperts DLL and not include the same source in a separate BPL file which then needs to be installed separately.
  14. baka0815

    GExperts Favorites as WP-Plugin

    Thanks for the positive reaction, but I would like to have comments on the code. 😉 My plan is to commit this as a patch, however I would like to clean up the code beforehand (therefore the rfc-tag).
  15. baka0815

    GExperts Favorites as WP-Plugin

    I'm currently experimenting with the ToolsAPI.WelcomePage API a bit and created a plugin for the GExperts favorites. My current work is a bit hacky, therefore there is currently no patch or something. I include the ToolsAPI.WelcomePage unit in the GX_FavFiles and have a separate type for the plugin there: TGXWelcomePagePlugin = class(TInterfacedObject, INTAWelcomePagePlugin, INTAWelcomePageContentPluginCreator) private FIconIndex: Integer; FView: TFrame; FFavoriteFilesExpert: TFavoriteFilesExpert; public constructor Create(const AFavoriteFilesExpert: TFavoriteFilesExpert); destructor Destroy; override; { INTAWelcomePagePlugin } function GetPluginID: string; function GetPluginName: string; function GetPluginVisible: Boolean; { INTAWelcomePageContentPluginCreator } function GetView: TFrame; function CreateView: TFrame; procedure DestroyView; function GetIcon: TGraphicArray; function GetIconIndex: Integer; procedure SetIconIndex(const Value: Integer); end; The AfterIDEInitialized procedure calls the creation of the plugin via the RegisterWelcomePage method. This does not work on first try, so there is a timer to catch the moment the WelcomePagePluginService is finally availabe. If anyone knows of a different way to register the plugin, please let me know! A dedicated, global "Register" procedure as used for BPL-Plugins didn't work. procedure TFavoriteFilesExpert.RegisterWelcomePage(Sender: TObject); begin // The WelcomePagePluginService might not be initialized the first time we get here, // so try again at a later time. if not Assigned(WelcomePagePluginService) then begin if (not Assigned(FPluginTimer)) then begin FPluginTimer := TTimer.Create(nil); FPluginTimer.OnTimer := RegisterWelcomePage; FPluginTimer.Interval := 2000; end; FPluginTimer.Enabled := True; end else begin FPluginTimer.Enabled := False; if (Assigned(FPluginTimer)) then FreeAndNil(FPluginTimer); WelcomePagePluginService.RegisterPluginCreator(TGXWelcomePagePlugin.Create(Self)); end; end; The welcome page gets the favorites expert as a parameter to be able to access the options (it may be sufficient to just pass the options). Then in the CreateView method I create a TfmFavFiles form and "steal" the tvFolders and pnlFiles objects and change the parent to the plugin view. function TGXWelcomePagePlugin.CreateView: TFrame; var FavFiles: TfmFavFiles; begin if not Assigned(FView) then begin FView := WelcomePagePluginService.CreateCaptionFrame(sPluginID, sPluginName, nil); FavFiles := TfmFavFiles.Create(nil, FFavoriteFilesExpert.FOptions); FavFiles.tvFolders.Parent := FView; FavFiles.pnlFiles.Parent := FView; end; Result := FView; end; This works form me, but is not in a state that I would like to upstream the work, so any input is greatly appreciated!
×