WebHub Object Pascal Components

OnNewSession, OnBadIP, OnBadBrowser handlers unique to projects v2.190
The core shared WebHub units no longer implement any OnNewSession, OnBadIP or OnBadBrowser event handlers. This code had been shared via dmWebHub.pas which almost all WebHub projects used.
The reason for this change is that the right type of handling varies too much between projects. It became very difficult and complicated to have a shared set of rules.
Sample code for handlers can be found in the online documentation, in the whsample_EvtHandlers unit and in the webhubdemos project source.
Developers are hereby alerted to carefully review this when upgrading. If you do not want anything to happen for those 3 situations, do nothing. If you were relying on code in dmWebHub and whsample_EvtHandlers to reject sessions etc., you need to copy that code (from an earlier version, or from the documentation, or from the demos) into your own datamodule.
If you counted on the built-in OnNewSession handler to send a droplet named chNewSession, then you must implement that in a custom datamodule when upgrading past v2.190.
Note: the OnBadIP event was not firing reliably in versions earlier than 2.189. However it is active now so you may need to test that your project is responding as you would like. To do this, request 2 or more pages from your application, copy the url including the session number, and then test that from another device such that the RemoteAddress changes. This will trigger the OnBadIP effect. The term "bad" here really means changed. There are circumstances such as mobile device usage while driving or when using certain ISPs where having a changing IP number is completely normal. The developer should decide whether or not that change is worth logging and/or acting on.
  • Generally: find whsample_EvtHandlers and replace with whgui_Menu in uses clauses
  • Generally: find whdmCommonEventHandlers and replace with whdmCommonMenu in PAS files
EOS exception cleared v2.190
The exception cannot release mutex not owned by caller when v3.x WebHub apps closed has been resolved so that it is no longer raised. This was exception had been an annoyance when working from the Delphi IDE.
Source reference: iniLink, tpApplic, tpMemConnection, tpShareB, tpSyncObjs
TtpProject surfaces instance sequence number v2.190
Sample usage where TtpProject component name is ProjMgr:
  CSSend('Started instance ' + IntToStr(ProjMgr.InstanceSequence) +
    ' ' + FormatDateTime('dddd dd-MMM hh:nn:ss', NowGMT) + ' gmt'); // uses ucMsTime, ucCodeSiteInterface
Source: tpProj.pas
New-ipc new methods v3.190
The developer must call pConnection.MarkReadyToWork; // uses webCall once, after all other initialization is complete for the new-ipc app to be considered ready to accept work requests. A good place to do this is in the datamodule containing TtpProject, in the OnStartupComplete event handler. This is a new requirement. The reason for this is to avoid any confusion (by the Hub) as to whether the application instance is ready, especially for applications that require some seconds to load all WHTEKO files and prepare numerous SQL statements.
There are other new methods on the pConnection object: MarkBusy, MarkIdle, MarkTerminateASAP, MarkSuspended. Most of these are for internal use only. However the developer may want to make use of MarkTerminateASAP if an access violation is detected and it would be best to stop the instance. Sample usage is in the webhubdemos project.
When running multiple instances serving a single AppID, do not call CoverApp during project startup. The application will automatically be considered in state Loading. Leaving the AppID uncovered means that traffic will route to the other instances serving that AppID for those seconds of load time.
The whsample_DMProjMgr.pas unit used by the WebHub wizard includes this code as of v3.197.
New command: IfNotBlankSV v2.190
This is an extended variation on the ASSIGNED command. The difference is that the parameter can have parentils and will be expanded prior to comparing it to a blank string.
SV stands for StringVar
Source: htWebApp.pas
A/V fix for service (un)install v2.191
The A/V happened after the service was (un)installed, during the final series of calls to Destroy objects. This did not occur when running as-app.
Source: tpProj.pas
As-Service Multi-Instance support improved v2.191
This sequence of steps now works:
:: webhubsample is a service installed for 3 instances
net start webhubsample1
net start webhubsample2
net start webhubsample3
:: hub sees 3 instances
net stop webhubsample2
:: hub sees 1st and 3rd instance
net start webhubsample2
:: 2nd instance re-created as #2
:: hub sees all 3 instances
This sequence also works:
net start webhubsample2
:: hub sees that as instance #2
Previously it was not possible to fill-in spot #2 while #3 was still running.
Source: tpProj, MultiTypeApp, MultiTypeAppSvc, webCall
Set your TtpProject InstanceMonitoringMode property to simmAppendInstanceNumToServiceName.
Fix for A/V on exitv2.191
Old ipc only
Source: ipcMailShared
DynURL.RawMVMRM property v2.191
For definition of letters that represent parts of URLs: http://www.href.com/pub/relnotes/prior/2.00/v2-089.htm
This gives you the necessary /scripts/runisa.dll? OR / string, depending on whether you are using ordinary WebHub URLs or remapping with StreamCatcher for short URLs. The idea is "To just-before the AppID" based on the most recent Request.
Win64 Support within Delphi IDEv2.192
TPack Components and WebHub v3 Components are now explicitly tagged as suitable for the win64 target platform.
Previously you could compile for win64, e.g. from BAT file or from FinalBuilder, but you could not add such components to a form or datamodule from the palette.
webErrors unit discontinuedv2.192
webErrors.pas is no longer shipping.
New unit: whSharedLogv2.193
Functionality relating to placement of shared WebHub logs has been moved from ucCodeSiteInterface.pas to whSharedLog.pas. Both units ship with full source.
This level of control matters most when doing intensive testing with CodeSite versions of the Hub, runner(s) and custom app(s).
Example usage is in TDemoExtensions. DemoAppUpdate in the WebHubDemos project. Use compiler conditionals -DCodeSite;Log2CSL if and only if you want your custom application to log a CodeSite on-disk CSL file. By default, just compiling with -DCodeSite, your custom application will log to the CodeSite Live Viewer. That is sufficient for most development work.
WHTEKO parser has been slightly refactored v2.194
Fixed a problem with loading some whteko files on win64.
AddMacro method does not add any trailing CRLFs.
Highly Experimental: new property, pWebApp.KeepCrLfAndLeadingSpaces (Boolean) defaults to False but can be set to True if you are concerned with preserving line breaks and leading whitespace within WebHub commands.
Please note that you can also control this behavior within any TwhWebAction .execute call. Look for the HtmlParamUnchanged property on the webaction component.
TwhdbSource is on the palette v3.194
It is on the WebHubDB palette. If you were using another custom type of TwhdbSource, consider using this one now instead.
htadoWApp unit discontinued v3.194
This unfinished component has been removed from the WebHub library in favor of the general-purpose TwhApplication component in the htwebapp.pas unit, which should suffice for ADO projects.
dmwhADOApp.pas also discontinued.
[Un]Cover App verb removed from webBase.pas v2.195
The code for bringing up a dialog to enable covering the current AppID has been moved from webBase.pas to whMain.pas.
Session-App link files v3.195
Data regarding the link from session number to a particular app process is now stored in a folder named applink under the WebHub Sessions folder. Example: D:\temp\whSessions\applink
The link can be made for as many AppIDs as are necessary, and for unlimited sessions. Previously the link was only made for a single AppID per session.
UseAppProcessID, HideAppProcessID v3.195
The HideAppProcessID property is no longer required. The AppProcessID never appears on the URL.
Response.SessionAppLink property has been removed.
A leading hyphen is no longer required when switching AppIDs within the same session.
For webrobots, a link is never saved from the robot SessionID to any AppProcessID.
It is necessary to use v3.195 Hub, Runner and Components for this feature to work.
TwhdbSource logs error if KeyFields are blank v3.196
TwhdbSource avoids A/V when FPending nil v3.196
Fixed unit: wdbSSrc.pas
Fix for SendBounce used with ANCHOR v3.196
This problem showed up for cases where a page used an ANCHOR within the first few hundred bytes of the page AND ended up calling Response.SendBounce or any method that called TwhBasicResponse.SendRedirection302. The output would be garbled and the surfer might receive a garbage target URL.
Fixed unit: htmlBase
Invalid guest lingvo resets to project lingvo v3.196
Fixed unit: whdm_Lingvo.pas
JUMP with command containing semi-colon v3.197
Command strings containing the ; symbol are no longer truncated at the semi-colon.
Fixed method: TwhSessionIDApp.GetJump in webCore.pas
RejectSession v3.197
RejectSession bounces to a URL starting with http(s) based on the incoming request scheme and authority.
Command strings containing ; are not truncated at the ; symbol.
IsWebRobotRequest v3.197
Previously the IsWebRobotRequest command only worked if an else-clause was specified. Now the else-clause is optional.
Fixed unit: htWebApp.
One-line WHTranslations v3.197
Single line translations are added to the Macros list now, instead of being added to the Droplets list.
webAjax unit v3.197
Source is included for those customers with a WebHub Useful Source license.
DCUs are included for both win32 and win64. Previously the DCU shipped only for win32.
OnPageCalcTime event v3.197
For high-traffic applications with a wide spread in timing of page execution, e.g. some pages requires 10ms and some require 1200ms, it may be advantageous to override the average page calculation time with a custom value. The page calculation time factors in when the Hub decides whether an incoming request is worth queueing, or should be rejected immediately.
See unit dserver_whdmGeneral.pas in webhubdemos project or search for OnPageCalcTime in the online help reference.
Allow Dynamic Authorityv3.198
For applications which intentionally allow requests from multiple authories per AppID (i.e. multiple web (sub)domain and port combinations), the WebHub app will now create additional server profiles (in memory, not on disk) as long as the App has at least one valid server profile to start from. If requests come in on both http and https, a valid server profile for both http and https is requred.
Values for the HttpServerID, URLForceCase, URLUseLingvo, URLUseShortFormat, URLUseScheme and URLDelimiter are copied from the server profile that the AppID points to.
For sites supporting many domains, this eliminates the need for manually entering dozens of server profiles.
This feature is best used with v3.198+.
Source: whcfg_App.pas, MatchServerProfile routine.
BDE choices removed from Wizardv3.198
BDE choices have been removed from the WebHub new-project wizard.
NB: Embarcadero Delphi does not compile BDE units for win64. This is the primary reason it is being removed from WebHub.
New event fires after all OnUpdate handlers are donev3.198
While the app is refreshing, it is in a Suspended state and does not receive page requests. When all on-update handlers have finished executing, the app is reset to an Idle state and takes page requests. Previously the app returned to Idle before the custom on-update handlers executed, and in high traffic situations, that led to page requests getting to the app before it was ready.
Source: htWebApp.pas, public procedure, DoAfterAllUpdateHandlers.
TwhBrowserLink and related UI elements removedv3.199
In the unlikely event that your project requires the webbrows unit, source is available in webbrows.txt and webBrowsGUI.txt as shipped with v3.199. Rename the source from TXT to PAS and save within your own project.
This component had been used to open exported HTM files in the default browser on the system.
TwhDCom removedv3.199
The Windows DCOM web action interface is no longer included in WebHub.

The Hub, WebHubAdmin, ZMAdmin

New-ipc Hub aware of subtle differences in app state v3.190
Both the Runtime and Components must be on v3.190 for these features to work.
The following common cases have been fully tested and confirmed working with new-ipc as of v3.190. If you want to repeat these tests yourself, use the Connected Panel in WebHubAdmin to see what the Hub is aware of.
  • Neither Hub nor App running: runner knows Hub is not available
  • Hub started; App not started: runner reports app not running
  • Hub started; App started but paused (manually for testing) prior to MarkReadyForWork: Hub sees the instance as Loading and runner reports app not running
  • Hub and App Started, confirmed ok, then Hub stopped and started:
  • App detects access violation and self-terminates.
Guardian feature added to Hub v3.191
New-ipc only
The Hub can monitor the number of instances serving selected AppIDs, and will (re)start instances if necessary. Instances will be started as-app or as-service, per configuration.
Requires WebHub Components of matching version, i.e. v3.191+.
Multi-thread logic refactored throughout new-ipc Hub, changing TSpinLock to TMultiReadExclusiveWriteSynchronizer.
For old-ipc, use separate WebHubGuardian service and please note that it was completely refactored as of 2.191 and should be retested prior to use on production servers.
HubApp more stable v2.191
Old-ipc only
The symptom had been that under heavy load, the HubApp would stop sending HELO messages and would fall off the connected panel. This could be seen in WebHubAdmin, on the Connected panel. It could be caused most quickly by running up many more instances than WebHubGuardian expected to have running for a given AppID.
Source: hub_dmProjMgr.pas
WebHubGuardian improved v2.191
Old-ipc only
When guardian detects an instance which is on the Connected panel but not running, it sends a Quit (goodbye) message on behalf of that instance, to speed up the Hub's recognition of its status.
Source: dmGuardianMailslots.pas
The location of the setting for the interval has moved from ZMKeybox.xml to WHCentralInfo.xml and can now be set in ZMAdmin under the Hub settings.
More stable when not-all instances suspended v2.191
Old-ipc only
The symptom had been that when one instance was suspended, it was possible for the Hub to indicate that ALL instances were suspended (randomly, with 1:N chance where N was the total number of instances serving the AppID). Now the Hub keeps looking for a non-suspended instance before giving up.
Source: FindRandomInstance in HubCall.pas
XSD for WHCentralInfo.xml adds 1 field v2.191
The new date for the XSD for WHCentralInfo is 201306. The complete url is http://static.webhub.com/xsd/cv004/WebHubCentralInfo201306.xsd
The new field is GuardianIntervalSeconds. This setting is now shared by v2.x and v3.x WebHubGuardian.exe and Hub.exe respectively.
Warning about invalid Slot Number no longer surfaced v3.191
New-ipc only
Details about this warning are now sent only to the error log. The surfer will see an Application Not Running error message.
If you can reproduce this problem at will, please give details to Tech Support.
WebHubAdmin Connected Panel improvedv3.192
New-ipc only
The Connected Panel shows accurate info when combined with both 32- and 64-bit versions of Hub.exe. Previously it worked only when both were 32-bit.
XSD for WHNetworkInfo.xml adds 2 fields v3.192
The new date for the XSD for WHCentralInfo is 201306. The complete url is http://static.webhub.com/xsd/cv004/WebHubNetworkInfo201306.xsd
The WorkingFolder for WebHub IPC and the SharedLogFolder for all parts of the system are now stored in WHNetworkInfo.
These can now be configured via ZMAdmin under WebHub Configuration > Connectivity Layer > Essential.
The WHTemp setting is obsolete for new-ipc.
Important Note 1. The Runtime Setup will MOVE your WHTemp setting to the new SharedLogFolder and WorkingFolder configuration spots. This is perfect if you upgrade Runtime plus custom applications immediately. If you need to keep running older WebHub v3 applications, please add the WHTemp setting back manually and remember to erase it when you have all apps on v3.192+. Instructions for setting WHTemp are in online docs.
System Message Files in multiple formats v2.192
The new date for the XSD for WHSystemMessages is 201306. The complete url is http://static.webhub.com/xsd/cv004/WebHubSystemMessages201306.xsd
The content type of WebHub system messages can now be overridden. This enables the runner to provide JSON, XML or other responses for error conditions based on PageID prefix, so that receiving web pages can process such errors via JavaScript when necessary.
These can now be configured via ZMAdmin under WebHub Configuration > Connectivity Layer > Messages > Message Content-Types and Messages > Overrides.
Ignore Session Cookie Name when session number located in URL v2.192
WHCentralInfo.xml contains both of those details. The cookie name is not relevant and should be ignored when the location is set to URL.
WebHubAdmin can cover any AppID v2.195
On the menu, the WebHubApp > [Un]Cover App selection brings up a dialog which lets you cover any AppID. Previously only the loaded AppID could be controlled.
ShutdownWHApps.exe v3.195
This utility now ships with WebHub Runtime and installs to the webhub\bin folder. If the Hub is running, running this utility will tell each connected WebHub application to exit immediately. This can be helpful in BAT files used for planned upgrades.
The version shipping with v3.195 works on win32 and win64, old- and new-ipc, Win2003, Win2008, Windows7, Win2012.
XSD for WHSystemMessages.xml adds AppIDBusy situation v3.196
The new date for the XSD for WHSystemMessages is 201307. The complete url is http://static.webhub.com/xsd/cv004/WebHubSystemMessages201307.xsd
To avoid this warning in the runner logs, "AppIDBusy·Text/AppIDBusy not found.value not found.", add the following node in WHSystemMessages.xml in the Situations node after AppCoverPage
andadd the following node in the same file under the Text node after AppCoverPage
If you see AppIDBusy messages more frequently than you think should occur, particularly if you are debugging from the IDE, or have a few very slow pages, what you should do is add the OnPageCalcTime event handler.
Hub has per-AppID Queues v3.197
new-ipc only
Performance improvement for web servers running more than one AppID. Requests now queue separately for each AppID. This means that requests to faster AppIDs can bypass those surfers waiting for slower AppIDs.
Hub uses multiple CPUs v3.197
The Hub v3.x is no longer restricted to using a single CPU. Hub v2.x remains on a single CPU.
WebHub System restart required when AppID added/removed v3.197
During development especially, please be aware that if you add or remove AppID definitions, you will need to restart both the http server (iisreset.exe) and the hub service. Modifications to existing AppIDs are fine, but if you add, remove or re-order the AppID entries, a restart is required.
Runner forces AppID on url to lowercase v3.197
runisa.dll?DEMOS and runisa.dll?demos both lead to AppID 'demos' now.
Speed measurements v3.198
The Hub can be compiled with minimal logging which indicates the speed of queuing and amount of idle time. Available upon request.
Hub okay if requests arrive before any app ready v3.198
This corner case has been fixed: requests arrive for an AppID for which the application has started to load but is not yet idle. Note that the Loading state is reported by the runner to the surfer as AppNotRunning.
New Hub commands to Report on Calls v3.199
There are two new URLs supported by the Hub which enable you to report on the number of calls made to each connected application. The report file is a plain-text tab-delimited raw data file which can be used by a wide range of reporting tools including gnuplot.
?h:r000 reset counters to zero
?h:r001 write the report file
The report file is saved to the shared logging folder.
Search for 'gnuplot' in the online help if you would like to see a complete example of using the report output.
Runner and Hub remain in contact after AppPool recycled v3.199
Depending on how often your IIS AppPool recycles, it may or may not have been noticable that in prior versions, after heavy traffic, the runner and Hub could lose contact. ?r:echo would work and static files would work, but requests for ?h:vers and all AppIDs would fail. This could be resolved by iisreset or reboot.
This problem has been resolved in v3.199 (5-Sep-2013).

WebHub Runners

Avoid timeout when processing pages larger than 16kb v3.194
new-ipc only
An issue has been fixed which led to a timeout condition when the output was streamed back to the surfer.
Faster v3.194
Response and operation time of the v3 isapi runner is significantly faster.
Faster v3.195
Runner response now has approx one third less overhead per request, for all requests except the first.
Runner DAT file obsolete v2.195
old-ipc only
The runisa.dat file was used to store session-app links for a single AppID when UseAppProcessID was true. This feature has been improved and re-implemented. Any old DAT files may be erased.
Runner implements Session-App links v2.195
The runner, not the Hub, implements any required links back to the same custom WebHub application instance.
The runner v2.195 and v3.195 support a leading hyphen before the AppID but that is no longer required.
Runner on multiple domains v2.196
As of this version, if the same runner is used on multiple domains, it only answers echo and version queries when there is an exact match to the admin authority.
Runner timeout seconds v3.196
In the TIMEOUT message, the number of seconds is accurately reported (not 0).
ISAPI runner terminates faster v3.197
The ISAPI runner will terminate well within 10 seconds now.
Speed measurements v3.198
The runner can be compiled with minimal logging which indicates the speed of processing. Available upon request.
Cover and Uncover commands v3.198
Use the r: prefix before cover and uncover commands for new-ipc.
Example URL for AppID demos: http://localhost/scripts/runisa64.dll?r:uncoverwhapp-demos
These commands work only on the admin authority for the RunnerID, which is http://localhost:80 by default.
Timeouts v3.198
Compared to v3.196 and v3.197, the runner should encounter and report far fewer timeouts, assuming the Hub is running and the app(s) are processing requests as they should be.