Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. pssDP

    TIDHTTPServer not receiving POST

    Found it !! Fist, I compiled myself IdCustomHTTPServer module source code, to not mess my installations, here is how: 1.) Copied IdCustomHTTPServer.pas, IdHTTPServer.pas, IDCompilerDefines.inc to the folder where is the source code of my project. 2.) Renamed those files in the original location C:\Program Files (x86)\Embarcadero\Studio\15.0\source\Indy10\Protocols 3.) Renamed IdCustomHTTPServer.dcu in the original location C:\Program Files (x86)\Embarcadero\Studio\15.0\lib\win32\release 4.) Added log lines to IdCustomHTTPServer.pas file added to my project, as I explained before The affected part is in the CreateSession procedure of IdCustomHTTPServer function TIdCustomHTTPServer.CreateSession(AContext: TIdContext; HTTPResponse: TIdHTTPResponseInfo; HTTPRequest: TIdHTTPRequestInfo): TIdHTTPSession; var LCookie: TIdCookie; // under ARC, convert a weak reference to a strong reference before working with it LSessionList: TIdHTTPCustomSessionList; begin Result := nil; GNDebugScan('Begin CreateSession, SessState: ' + BoolToStr(SessionState) + ', SessList: ' + BoolToStr(Assigned(FSessionList))); if SessionState then begin LSessionList := FSessionList; if Assigned(LSessionList) then begin DoOnCreateSession(AContext, Result); GNDebugScan('After DoOnCreateSession, Result: ' + BoolToStr(Result <> nil)); if not Assigned(Result) then begin Result := LSessionList.CreateUniqueSession(HTTPRequest.RemoteIP); end else begin LSessionList.Add(Result); end; GNDebugScan('CreateSession, after CreateUnique: ' + BoolToStr(Result <> nil)); LCookie := HTTPResponse.Cookies.Add; LCookie.CookieName := GSessionIDCookie; LCookie.Value := Result.SessionID; LCookie.Path := '/'; {Do not Localize} // By default the cookie will be valid until the user has closed his browser window. // MaxAge := SessionTimeOut div 1000; HTTPResponse.FSession := Result; HTTPRequest.FSession := Result; end; end; GNDebugScan('End CreateSession, SessState: ' + BoolToStr(SessionState) + ', Result: ' + BoolToStr(Result <> nil)); end; With that inserted, I saw that the session was not correctly inserted in the LSessionList because of this in my CreateSession event: procedure TAmWebAgeSvc.HTTPServerCreateSession(ASender: TIdContext; var VHTTPSession: TIdHTTPSession); begin GNDebugScan('CreateSession: ' + VHTTPSession.Content.CommaText); end; That is, the fact that I used VHTTPSession.Content.CommaText as a debug messed up this var variable. Once I deleted this reference, the program now runs as expected. Now, I will restore all the original files to their original location It goes without saying that I must deeply thank Remy for the help provided.
  3. Today
  4. Uwe Raabe

    Getting Exception stack trace in 2021

    Indeed! Perhaps my advantage is that I had communicated with Matthias personally in German, so I never stumbled upon the name similarity.
  5. 0x8000FFFF

    UnEscape JSON string

    What do you mean, what is the difference between 'the whole JSON string' and 'a certaing value'? Can you name some examples?
  6. Edwin Yip

    Getting Exception stack trace in 2021

    You really have a good memory :D
  7. Edwin Yip

    Getting Exception stack trace in 2021

    Well, well, well, I had that misconception too! While I was puzzled why madshi provides the open source DebugEngine while he already has the madExcept commercial package, but I didn't think too much since Jeroen said so... Maybe people confused by the name 'Mahdi' with 'madshi' the nickname :) I shouldn't have that misconception - because IIRC I asked Mahdi Safsafi and he's a doctor from the Middle-east, while IIRC madshi is in Germany...
  8. thomh

    UnEscape JSON string

    Thank you. BTW, is there a method that you can use to unescape the whole JSON string and not just a certain value? // Thom
  9. Yesterday
  10. Wagner Landgraf

    Getting Exception stack trace in 2021

    Spot on! Thanks for letting me know I'm not completely insane yet. 😅
  11. In my application I generate a SVG graphic in a TCppWebBrowser by providing GraphViz dot language code that is converted to SVG by a JavaScript version of GraphViz viz.js. File _test.html shows the original HTML page (dot code and JavaScript code) that produces the SVG output shown in file test.html. In the form with the TCppWebBrowser component I added some buttons to zoom in, out and reset to 100%: //--------------------------------------------------------------------------- void __fastcall TFormViewer::btZoomInClick(TObject *Sender) { ZoomFactor *= 1.1; OleVariant ZoomFac = int(ZoomFactor); CppWebBrowser1->ExecWB(63, OLECMDEXECOPT_DONTPROMPTUSER, ZoomFac, 0); } //--------------------------------------------------------------------------- void __fastcall TFormViewer::btZoomOutClick(TObject *Sender) { ZoomFactor *= 0.9; OleVariant ZoomFac = int(ZoomFactor); CppWebBrowser1->ExecWB(63, OLECMDEXECOPT_DONTPROMPTUSER, ZoomFac, 0); } //--------------------------------------------------------------------------- // void __fastcall TFormViewer::btResizeClick(TObject *Sender) { ZoomFactor = 100; OleVariant ZoomFac = int(ZoomFactor); CppWebBrowser1->ExecWB(63, OLECMDEXECOPT_DONTPROMPTUSER, ZoomFac, 0); } This works fine but for huge networks with hundreds of elements I would like to zoom to a specific element by name (in test.html e.g. to "HE M15". My idea is to change the viewBox attribute of the svg object. So, I need to find the element with the specific name (e.g. "HE M15"), read the x, y coordinates of the text and change the viewBox accordingly. Would this be possible by IHTMLWindow2::execScript (JavaScript code) or other tools to access the DOM... or would it be easier to save the html page, load it in a StringList, search the element and coordinates there and change the viewBox attribute, save the file and load it into the TCppWebBrowser component again? __test.html test.html
  12. Anders Melander

    Getting Exception stack trace in 2021

    You probably read it here: https://wiert.me/2017/08/02/delphi-call-stack-from-exception/
  13. Last week
  14. Uwe Raabe

    Showcase @Emba - should i?

    The zip file containing the source also contains an AlgoSim.dpr, but the dproj is still missing. Thus the project cannot be compiled as some units are not found. Also the package projects for the design time components are missing, but a quick analysis revealed that all pas files are included.
  15. Bill Meyer

    Showcase @Emba - should i?

    There is an ISS file for InnoSetup. That may, with some editing, be the missing link.
  16. Wagner Landgraf

    Getting Exception stack trace in 2021

    Indeed, I google'd a lot and for some reason I set a flag they were both the same person. I thought I read it somewhere, but it looks I was mistaken.
  17. Anders Melander

    Getting Exception stack trace in 2021

    Potato, Phothatho
  18. Anders Melander

    Showcase @Emba - should i?

    Download source: 1 minute. Browse through source: 3 minutes Write wise-ass response here: 15 seconds. As far as I can tell there are no 3rd party dependencies, it's VCL and Delphi Pro should be sufficient. The project files (dpr, dproj) seems to be missing though so good luck building it...
  19. Uwe Raabe

    Getting Exception stack trace in 2021

    What makes you think that? madExcept is from Matthias Rauen (aka madshi) and DebugEngine is from Mahdi Safsafi.
  20. aehimself

    Getting Exception stack trace in 2021

    I had ~2 releases with DebugEngine, then I switched back to MadExcept. It's stack traces are less messed up when packed with UPX. I'd personally prefer DebugEngine as it is not installing hooks (thus - not having the issues I mentioned) getting stack traces is it's main purpose. Performance wise - you won't feel a difference tbh. None of these tools will make your application less stable or significantly slower.
  21. Unfortunately, there is no script, but the video is short, perhaps you will find time to watch it)
  22. Wagner Landgraf

    Getting Exception stack trace in 2021

    Thank you very much for the feedback. Since you mentioned you just "gave it a try", you are not using it anymore, and/or didn't use it in production? I'm also interested in knowing how it is (and the other mentioned tools) when it comes to performance and stability, since I intend to use it in server applications.
  23. aehimself

    Getting Exception stack trace in 2021

    I gave DebugEngine a try and it is very good. Sometimes it provides stack traces strange (method where exception happened, two inner methods of DebugEngine and then the real stack trace) but it's really easy to install and use. It is also unaffected by the two issues I have with MadExcept (TThread.FatalException and Exception.InnerException is rendered useless). It comes with a utility to attach the map (or it's own compressed smap) format to the .EXE itself, however the final executable is larger than with MadExcept (guess the .map compression is not that advanced in DebugEngine than in MadExcept). I don't have much experience with JclDebug... I tried it once, and I disliked every bit of it. Only to be able to see stack traces I had to include ~30 extra files in my project and the stack traces were not accurate.; so I gave up on it. If you can fit into the free usage conditions of MadExcept I'd say go with that. Otherwise, DebugEngine (or a license for MadExcept) would be my choice. P.s.: keep in mind that also MadExcept and DebugEngine is known to have stack issues if the .exe is packed with UPX.
  24. I wonder what is a good way to get the stack trace when an exception happens? I know about madExcept and EurekaLog but I was willing to have something lighter and simpler. After a long Google-Fu session, it looks like using JclDebug is still the way to go? I also read here and there that madExcept is better at such job than JclDebug, and since DebugEngine is provided by the madExcept author, I wonder if it (DebugEngine) is a better alternative than JclDebug? Or is there even a more direct, straightforward way to get the stack trace these days?
  25. Dany Marmur

    Showcase @Emba - should i?

    https://blogs.embarcadero.com/this-ultimate-mathematical-visualization-software-comes-with-full-delphi-source-code/?utm_source=Eloqua&amp;utm_medium=email&amp;utm_content=Article-210514-DataVisualization Looks interesting. But nowhere could i find the requisites for compiling the project. Is it Professional, Enterprise? Is it VCL, FMS or both? Pls do not answer "download and try yourself" because i'm sooo limited re time and that is because of Emba (10.4.2). Thankful for any insights, /D
  26. pssDP

    TIDHTTPServer not receiving POST

    In my first post of this thread you can see what TIdLogFile gives me, and, if you remember I told about that there is no date and time in this log, even if I included this code: Intercept := TIdServerInterceptLogFile.Create(nil); Intercept.Filename := 'C:\TMP\DBGLOG.TXT'; Intercept.LogTime := True; HTTPServer.Intercept := Intercept; HeadersAvailable, CreatePostStream and ParseAuthentication events are fired, and nothing more. In HeadersAvailable event I have VContinueProcessing and HTTPServer.SessionState both true. What I did was to insert temporally log lines only and nothing more, in the source code of IdCustomHTTPServer module, and compile this module only, not the entire Indy, to avoid messing my production environment, but I think that it is not possible, or at least, I do not know how to do. I mean that both OnCommandOther and OnCommandGet are not fired. I am using HTTPS, I will try to get a Wireshark capture and post it here.
  27. Remy Lebeau

    TIDHTTPServer not receiving POST

    On a side note: Indy has logging components, such as TIdLogFile, that you can attach to each connection's IOHandler.Intercept property, such as in the server's OnConnect event. I would suggest doing that instead of rolling your own logging code. If, for no other reason, than because you are opening and closing the log file on every message logged, which is highly inefficient. There is no possible way that HeadersCanContinue() and CreatePostStream() would not be called for every request. So I have to assume that the changes you made to Indy's source code did not take effect, ie you did not recompile Indy, and then recompile your app with the updated library. If that is not the case, then something else is going on that I can't see. Obviously, OnCommandOther would not be called for a GET request, OnCommandGet would be called instead. At this point, your debugging efforts are not really helping. And I don't have a working environment that I can test with. So, we are at a stalemate. Can you, at least, provide a complete log or Wireshark capture of the entire HTTP conservsation that is not working for you? Also, are you using plain HTTP or secure HTTPS? You said originally that the problem did not start happening until you made a modification to your web server - what was that modification exactly?
  28. Mike Torrettinni

    Micro optimization: Math.InRange

    Interesting that all these calculations (- and * and comparison) are as fast as simple 2 value comparisons.
  1. Load more activity
×