Skip to content

Fix PR #10 review comments: null safety, interface visibility, cookie parsing, WebSocket headers, typos#11

Merged
ReneSchwarzer merged 2 commits intodevelopfrom
copilot/update-readme-documentation
Apr 2, 2026
Merged

Fix PR #10 review comments: null safety, interface visibility, cookie parsing, WebSocket headers, typos#11
ReneSchwarzer merged 2 commits intodevelopfrom
copilot/update-readme-documentation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Addresses 14 Copilot review comments on PR #10 (0.0.10-alpha). Fixes span correctness bugs, API design issues, and naming inconsistencies introduced by that PR.

Bug Fixes

  • TaskManager: CreateTask/CreateTask<TTask> were calling _dictionary.TryGetValue(id, ...) instead of _dictionary.TryGetValue(key, ...) after lowercasing — allowing duplicate entries with different casing. RemoveTask would throw NullReferenceException/ArgumentNullException when task or task.Id is null; added early return guard.

  • RequestHeaderFields — cookie parsing: c.Split('=')[1] throws on malformed cookies and misparses values containing = (e.g. base64). Now splits on ; first, then on the first = only:

    // before
    .Select(c => { var split = c.Split('='); return new Cookie(split[0], split[1]); })
    
    // after
    .SelectMany(c => c.Split(';', ...))
    .Select(c => { var i = c.IndexOf('='); return i < 0 ? null : new Cookie(c[..i], c[(i+1)..]); })
    .Where(c => c != null)
  • UnitTestRandomId.HexCharacters: Substring(4) skips one extra character past the id_ prefix (length 3), leaving one hex char unvalidated. Changed to Substring("id_".Length).

API / Design Fixes

  • IUriPathSegment: internal members (Id, IsHidden setter, Uri setter) on a public interface make it unimplementable from external assemblies. Removed internal modifiers.

  • ResponseHeaderFields.ToString(): Sec-WebSocket-Accept was never emitted, breaking WebSocket handshake responses. Added emission when SecWebSocketAccept is set.

  • ISocketContext.MaxMessageSize: Type was ulong but docs stated null means "no limit". Changed to ulong? throughout (ISocketContext, SocketContext, SocketItem, SocketManager); null now correctly represents unlimited.

Naming / Clarity

  • SegmentRegexAttribute, SegmentStringAttribute, SegmentUIntAttribute: Parameter named display was passed directly as tag to path segment constructors — misleading. Renamed to tag.

  • UriQuery<TParamerer>: Typo in generic type parameter name. Renamed to TParameter.

  • ISockt.cs: Renamed to ISocket.cs; updated misleading doc comment referencing non-existent cancellation token and connectMessage parameters.

Test Fix

  • UnitTestStatusPageManager: Expected content length of 78 was stale after the PR's HTML rendering changes produced 72. Updated inline data.

…interface visibility, WebSocket headers

Agent-Logs-Url: https://github.com/webexpress-framework/WebExpress.WebCore/sessions/21fd93fa-c2a8-4f06-a85f-237eec4ad043

Co-authored-by: ReneSchwarzer <31061438+ReneSchwarzer@users.noreply.github.com>
Copilot AI changed the title [WIP] Update README documentation for clarity Fix PR #10 review comments: null safety, interface visibility, cookie parsing, WebSocket headers, typos Apr 2, 2026
Copilot AI requested a review from ReneSchwarzer April 2, 2026 20:59
@ReneSchwarzer ReneSchwarzer marked this pull request as ready for review April 2, 2026 21:03
@ReneSchwarzer ReneSchwarzer merged commit a7d5c72 into develop Apr 2, 2026
@ReneSchwarzer ReneSchwarzer deleted the copilot/update-readme-documentation branch April 2, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants