Skip to content

v3.3.0

Choose a tag to compare

@michaelJustin michaelJustin released this 23 Sep 10:40
· 68 commits to master since this release
Immutable release. Only release title and notes can be modified.
71d4d2f

Security

  • TdjWebComponentHandler.InvokeService's 500 response no longer discloses
    the component class name, the exception class name, or the exception
    message by default — the body is now generic
    (500 Internal Server Error) unless DARAJA_PROJECT_STAGE_DEVELOPMENT is
    defined, matching the existing gating of the stack-trace block. The full
    detail (component/exception class and message, plus stack trace when
    available) is now always logged server-side via the framework logger,
    regardless of what the client response discloses. (#520)
  • TdjHTTPServer.MyOnException and TdjHTTPConnector.OnCommand now log a
    malformed request line (EIdHTTPErrorParsingCommand) and a client that
    dribbles or never finishes a request (EIdReadTimeout, e.g. Slowloris) at
    Debug instead of Warn/Error, since spraying malformed requests could
    otherwise inflate the log volume for free. Every other exception keeps its
    existing level. (#521)
  • TdjHTTPConnector.OnCommand left ResponseNo at -1 when it swallowed an
    exception from request handling, which depending on Indy's handling of an
    invalid status could send the client an empty or malformed response
    instead of a clean 500. It now sets ResponseNo := 500 with the same
    generic, detail-free body as TdjWebComponentHandler.InvokeService's
    default error page. (#517)
  • The request target is now normalized once, centrally, before routing:
    ., .. and repeated / are collapsed by path segment, and a
    Servlet-style ;-parameter is stripped, before a filter's or component's
    URL pattern is matched against it. A target carrying an embedded NUL or
    other raw control byte is rejected with 400 instead of reaching
    routing. This also fixes a real bypass: TdjWebComponentHandler.Handle
    used to match a filter's prefix pattern against the raw,
    context-prefixed target while matching the guarded component against the
    context-stripped path, so a prefix-pattern filter (e.g. /secure/*)
    silently never applied on any non-root context. (#530)

Added

  • TdjWebComponentHolder.LoadOnStartup: an integer property, mirroring the
    Servlet spec's load-on-startup element, that controls the order in which
    Web Components are initialized when their context starts — lower values
    first, ties (including the default, 0) broken by registration order. (#492)
  • A negative LoadOnStartup now defers initialization of a Web Component
    until the first request that matches it, instead of starting it eagerly at
    context start. Concurrent first requests are safe (only one triggers
    Init); if that Init raises, the triggering request gets a 500
    response and the component is retried, not permanently unavailable, on the
    next request. (#496)
  • TdjWebComponent.OnGetETag: an overridable method, alongside
    OnGetLastModified, that lets a Web Component supply an ETag for
    conditional GET/HEAD. When a request carries If-None-Match, it alone
    decides whether the response is 304 Not Modified, per RFC 7232 Section
    3.3; If-Modified-Since is only consulted when the request has no
    If-None-Match. Matching is weak (a leading W/ is ignored on either
    side), and If-None-Match: * matches any current representation. (#430)

Changed

  • TdjWebComponent.OnOptions now defaults to 200 with an Allow header
    listing the HTTP methods the component supports (i.e. the On* handlers it
    overrides, plus the implied HEAD), and no response body, instead of
    405 Method Not Allowed. A 405 response — whether from a not-overridden
    handler or set explicitly — now also carries the same Allow header. (#429)
  • Replaced the single EWebComponentException with an exception hierarchy:
    EDarajaException is now the common base, with EDarajaConfigException,
    EDarajaMappingException and EDarajaLifecycleException for configuration,
    registration/mapping and lifecycle errors respectively, so callers can
    distinguish the cause of a failure. EWebComponentException is removed;
    code catching it should catch EDarajaException or one of the specific
    subclasses instead. (#435)

Fixed

  • TdjLifeCycle.Start could run DoStart twice for the same instance when
    two threads called Start concurrently before either had finished; it now
    re-checks the started state after acquiring its lock. (#496)
  • A TdjWebComponent.Init exception during TdjWebComponentHolder.DoStart
    was swallowed, leaving the holder marked as started with a half-initialized
    component instead of stopped; it now propagates so the holder is correctly
    left not started. (#496)
  • A 304 Not Modified response from TdjWebComponent's conditional GET/HEAD
    handling omitted the Date and Last-Modified headers that a 200
    response to the same request would have carried; it now sends both (and
    ETag, if the component supplies one), per RFC 7232 Section 4.1. (#430)
  • A failed TdjLifeCycle.Start left FStarted / FStopped at their
    pre-Start values without undoing whatever DoStart had partially started
    (e.g. connectors already bound before a later one failed), so Destroy's
    if IsStarted then Stop never reached them and they leaked for the
    lifetime of the process. Start now best-effort rolls back via DoStop on
    a DoStart failure before re-raising the original exception. (#498)
  • TdjStatisticsFilter.DoFilter dereferenced Request.Session.Content
    unconditionally, so a context without auto-sessions enabled (or a client
    with no session cookie) crashed with an access violation on every
    request. It now raises a clear EDarajaConfigException explaining that
    the filter's context must be created with sessions enabled, instead of
    AVing. (#516)

Internal

  • HTTPTestCase (test helper base class): extracted the URL-normalization
    logic duplicated across nearly every Check* method into ResolveURL,
    and the hoNoProtocolErrorException toggle duplicated across nine methods
    into AllowErrorResponseCodes. No behavior change. (#509)
  • New test coverage: TdjHandlerCollection's per-handler exception isolation
    on Start/Handle, and its start/stop-on-mutation behavior in
    AddHandler/RemoveHandler; TdjContextHandler.ContextMatches'
    path-prefix and connector-name whitelist matching. (#501)
  • TdjWebComponent and TdjWebFilter doc comments now spell out the
    single-instance threading contract (one instance per registered
    component/filter, shared across all concurrent request threads — do not
    keep per-request state in instance fields); the getting-started guide's
    "Web Components and multi-threading" section was fixed (a broken code
    example) and expanded to match. (#513)
  • TdjPathMap.Matches's unreachable stUnknown branch now asserts (debug
    builds only, via {$IFDEF DEBUG}) instead of raising a bare Exception,
    so a future bug here would surface as a routing 404 rather than an
    uncaught exception turning into a 500. No behavior change: registration
    already rejects stUnknown patterns (#422), so the branch stays
    unreachable in practice. (#519)
  • Version constant set to 3.3.0. (#515)