Skip to content

HttpException: Connection closed before full header was received #298

Description

@lindeer

firefox: 117.0
geckodriver: 0.34.0
OS: fedora 38

  final proc = await Process.start(
      'geckodriver',
      ['--port=4445'],
    );
  final lines = proc.stdout.transform(utf8.decoder).transform(LineSplitter());
  await for (final line in lines) {
    if (line.contains('127.0.0.1:4445')) {
      break;
    }
  }
  final opts = Map.of(drv.Capabilities.firefox);
  final driver = await drv.createDriver(
    uri: Uri.parse('http://localhost:4445/'),
    desired: opts,
    spec: drv.WebDriverSpec.W3c,
  );

error happened:

Unhandled exception:
HttpException: Connection closed before full header was received, uri = http://localhost:4445/session

but when I changed await for as follow, everything is OK, have no idea why:

  final c = Completer();
  lines.listen((line) {
    if (line.contains('127.0.0.1:4445')) {
      c.complete();
    }
  });

  if (!c.isCompleted) {
    await c.future;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions