Skip to content

Bug: /discover endpoint hangs — Chrome ignores HTTP/1.0, raw TCP read blocks indefinitely #30

@justrach

Description

@justrach

Problem

The /discover endpoint uses raw TCP to fetch Chrome's /json/list, but:

  1. Chrome DevTools HTTP server ignores HTTP/1.0 requests (returns 0 bytes)
  2. With HTTP/1.1 + Connection: close, the stream.read() loop blocks waiting for more data because Chrome doesn't close the connection promptly
  3. net.Address.resolveIp() fails for hostname localhost — need parseIp4("127.0.0.1", port)

Fix Options

  • Use HTTP/1.1 with Content-Length-aware read loop (parse headers, read exact body length)
  • Add socket read timeout via setsockopt(SO_RCVTIMEO) on the raw fd
  • Consider using std.http.Client from Zig 0.15.1 instead of raw TCP

Files

  • src/server/router.zig (handleDiscover)
  • src/cdp/websocket.zig (same resolveIp issue in parseWsUrl — should use parseIp4 for localhost)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p0Highest prioritystatus:doneWork item is complete

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions