Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add host option in launchServer options #30999

Merged
merged 1 commit into from
May 27, 2024

Conversation

cavivie
Copy link
Contributor

@cavivie cavivie commented May 24, 2024

Closes 30998.

@cavivie
Copy link
Contributor Author

cavivie commented May 24, 2024

@microsoft-github-policy-service agree

@cavivie cavivie marked this pull request as draft May 24, 2024 06:29
@cavivie cavivie force-pushed the main branch 2 times, most recently from afbc5bd to 9577643 Compare May 24, 2024 06:32

This comment has been minimized.

@cavivie cavivie marked this pull request as ready for review May 24, 2024 06:42

This comment has been minimized.

Copy link
Member

@mxschmitt mxschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % comments

docs/src/api/class-android.md Outdated Show resolved Hide resolved
docs/src/api/class-android.md Outdated Show resolved Hide resolved
docs/src/api/class-browsertype.md Outdated Show resolved Hide resolved
docs/src/api/class-browsertype.md Outdated Show resolved Hide resolved
@cavivie cavivie force-pushed the main branch 2 times, most recently from 5ae09b1 to d7d5785 Compare May 24, 2024 07:57

This comment has been minimized.

@cavivie
Copy link
Contributor Author

cavivie commented May 24, 2024

@mxschmitt Is this dirty error caused by me pushing twice quickly?

This comment has been minimized.

@mxschmitt
Copy link
Member

@mxschmitt Is this dirty error caused by me pushing twice quickly?

You need to run npm run build, it will then update some generated files.

@cavivie
Copy link
Contributor Author

cavivie commented May 24, 2024

BTW, I found that although the ws server pointed out that the ws url was localhost, it actually listened at 0.0.0.0. This is because the http server listen uses net.Server listen. When the host is omitted (undefined) in this method, the unspecified address will be used.

https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/utils/wsServer.ts#L57-L83

https://nodejs.org/api/net.html#serverlistenport-host-backlog-callback

To fix it, we need to do either of these things:

  1. We may need to open a new bug issue for this and fix it: set hostname to localhost instead of undefined, line to change, because undefined means that ws net servers listen on the unspecified address ipv4(0.0.0.0)/ipv6(::).
  2. We only change the document description to unspecified, and chang the hostname in the ws url to undefined value to 0.0.0.0 but notlocalhost, line to change.

This comment has been minimized.

@cavivie cavivie force-pushed the main branch 3 times, most recently from 63e9e16 to 6dc063e Compare May 24, 2024 09:45

This comment has been minimized.

@cavivie
Copy link
Contributor Author

cavivie commented May 24, 2024

2. We only change the document description to unspecified, and chang the hostname in the ws url to undefined value to 0.0.0.0 but notlocalhost, line to change.

Finally, I followed this to keep compatibility, what do you think?

This comment has been minimized.

docs/src/api/class-android.md Outdated Show resolved Hide resolved
docs/src/api/class-browsertype.md Outdated Show resolved Hide resolved

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

2 flaky ⚠️ [chromium-library] › library/trace-viewer.spec.ts:240:1 › should have network requests
⚠️ [webkit-page] › page/workers.spec.ts:243:3 › should support offline

27061 passed, 609 skipped
✔️✔️✔️

Merge workflow run.

@cavivie cavivie requested a review from mxschmitt May 25, 2024 05:41
@mxschmitt mxschmitt merged commit a7599ad into microsoft:main May 27, 2024
30 checks passed
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.

[Feature]: launchServer bind hostname or address
3 participants