Commit Graph

1774 Commits

Author SHA1 Message Date
Anmol Sethi 966e9cc238
Merge pull request #2609 from cdr/proxy-res-d629
Fix body proxying, redirect proxying and add tests
2021-02-01 11:39:44 -05:00
Anmol Sethi a60f61f9b3
proxy.test.ts: Add POST body test and redirection tests
Closes #2377
2021-02-01 11:16:52 -05:00
Anmol Sethi 58d72d53a1
routes/index.ts: register proxy routes before body-parser
Any json or urlencoded request bodies were being consumed by body-parser
before they could be proxied. That's why requests without Content-Type
were proxied correctly as body-parser would not consume their body.

This allows the http-proxy package to passthrough the request body correctly
in all instances.

Closes #2377
2021-02-01 11:08:40 -05:00
Anmol Sethi f5cf3fd331
proxy.ts: Do not always rewrite redirects against the base path
This breaks --proxy-path-passthrough

However, we still need this when that code is disabled as many apps will
issue absolute redirects and expect the proxy to rewrite as appropriate.

e.g. Go's http.Redirect will rewrite relative redirects as absolute!
See https://golang.org/pkg/net/http/#Redirect
2021-02-01 11:08:40 -05:00
Anmol Sethi d7f06975a6
test: Switch from leaked-handles to wtfnode (#2604)
See my comments at
https://github.com/cdr/code-server/pull/2563#issuecomment-763394741
2021-02-01 11:06:49 -05:00
Anmol Sethi 5446e0ad43
doc/FAQ.md: Link to VSCodium's extension marketplace docs as well (#2603) 2021-02-01 09:52:16 +00:00
Anmol Sethi 22ebfdc3af
doc/guide.md: Update caddy install instructions (#2601)
Caddy has new installation instructions for Debian.

Closes #2599
2021-02-01 09:51:48 +00:00
Joe Previte aab973a795
Merge pull request #2640 from cdr/issue-1343-control-c
doc/ipad.md: add ctrl c workaround
2021-01-28 16:33:03 -07:00
Joe Previte a4a0048b90
Merge pull request #2639 from cdr/ipad-docs-install-pwa
doc/ipad.md: add install pwa
2021-01-28 16:32:46 -07:00
Dean Sheather 1fcb0c3ddd
Merge pull request #2641 from cdr/send-ready-to-all-origins
Send 'loaded' event to all parent origins
2021-01-27 05:52:13 +10:00
Dean Sheather 42dcfc94ab
Send 'loaded' event to all parent origins 2021-01-27 05:06:04 +10:00
Joe Previte db359c40c7
docs: add install pwa to ipad 2021-01-26 11:18:41 -07:00
Joe Previte 8f0066b4a8
docs: add ctrl c workaround for ipad 2021-01-26 10:44:27 -07:00
Joe Previte fa548e95e1
Merge pull request #2564 from cdr/issue-2550-migrate-mocha-jest
refactor(tests): migrate from mocha to jest
2021-01-25 17:12:39 -07:00
Joe Previte 102f51ce1f
fix: surpress console log in cli test 2021-01-25 16:34:43 -07:00
Joe Previte 14c5aecd45
chore: update ts config and jest config 2021-01-25 16:34:32 -07:00
Joe Previte 3044224729
feat: add support for code coverage shield 2021-01-25 16:21:07 -07:00
Joe Previte 05beccf671
refactor: move jest around and add code coverage 2021-01-22 14:18:45 -07:00
Joe Previte 883dd13850
refactor: move jest and add package.json to /test 2021-01-21 14:06:49 -07:00
Joe Previte 646ee3ad7f
refactor: correct type signature in app.ts 2021-01-21 10:11:56 -07:00
Joe Previte 850c7e1a91
fix: add void for resolve in socket test 2021-01-21 10:11:10 -07:00
Joe Previte 6bf51caa17
fix(app.ts): resolve with server 2021-01-21 10:11:10 -07:00
Joe Previte f13ba9401b
fix(TS error): add void to promise in util 2021-01-21 10:11:10 -07:00
Joe Previte 75717749b2
refactor: upgrade TS to 4.1.3 2021-01-21 10:11:09 -07:00
Joe Previte 0a07d67c8d
fix: prevent mocha/jest types conlict
Modify the tsconfig.json in lib/vscode/src/build.

This adds the flag skipLibCheck: true to tell TypeScript
to not type-check the declaration files at build time.

We need to add this because otherwise it checks the declaration
files and reports an error of duplicate type definitions
because we use Jest for our tests and they use Mocha and they
both use the global namespace "test" in their .d.ts files.
2021-01-21 10:11:09 -07:00
Joe Previte bea8bb0519
refactor: remove mocha 2021-01-21 10:10:33 -07:00
Joe Previte de7d0394ae
refactor: tests from mocha to jest 2021-01-21 10:10:32 -07:00
Joe Previte cef7d42652
feat: setup jest 2021-01-21 10:10:32 -07:00
Torbjørn Viem Ness c52198f30d
install.sh: Fix usage of su (#2529)
See also https://github.com/cdr/code-server/pull/2529#issuecomment-763829674
2021-01-20 13:03:13 -05:00
Anmol Sethi 28e98c0ee0
Merge pull request #2563 from cdr/proxy-path-passthrough-0bb9
pathProxy.ts: Implement --proxy-path-passthrough
2021-01-20 02:44:29 -05:00
Anmol Sethi c32d8b155f
heart.ts: Fix leak when server closes
This had me very confused for quite a while until I did a binary search
inspection on route/index.ts. Only with the heart.beat line commented
out did my tests pass without leaking.

They weren't leaking fds but just this heartbeat timer and node of
course prints just fds that are active when it detects some sort of leak
I guess and that made the whole thing very confusing. These fds are not
leaked and will close when node's event loop detects there are no more
callbacks to run.

no of handles 3

tcp stream {
  fd: 20,
  readable: false,
  writable: true,
  address: {},
  serverAddr: null
}

tcp stream {
  fd: 22,
  readable: false,
  writable: true,
  address: {},
  serverAddr: null
}

tcp stream {
  fd: 23,
  readable: true,
  writable: false,
  address: {},
  serverAddr: null
}

It kept printing the above text again and again for 60s and then the
test binary times out I think. I'm not sure if it was node printing the
stuff above or if it was a mocha thing. But it was really confusing...

cc @code-asher for thoughts on what was going on.

edit: It was the leaked-handles import in socket.test.ts!!!
Not sure if we should keep it, this was really confusing and misleading.
2021-01-20 02:06:44 -05:00
Anmol Sethi 5c06646f58
Formatting and linting fixes 2021-01-20 02:06:44 -05:00
Anmol Sethi 60233d0974
test/proxy.test.ts: Implement 2021-01-20 02:06:44 -05:00
Anmol Sethi 240c8e266e
test: Implement integration.ts for near full stack integration testing 2021-01-20 02:06:44 -05:00
Anmol Sethi 64e915de4a
test: Rename testutil.ts to httpserver.ts 2021-01-20 02:06:44 -05:00
Anmol Sethi d3074278ca
app.ts: Fix createApp to log all http server errors
cc @code-asher
2021-01-20 02:06:43 -05:00
Anmol Sethi 8acb2aec11
plugin.test.ts: Switch to testutil.HttpServer 2021-01-20 02:06:43 -05:00
Anmol Sethi ea1949e440
test: Add testutil.HttpServer
The goal is to remove supertest as it does not support typescript well
and there's really no good reason for the dependency. Also no websocket
testing support.
2021-01-20 02:06:43 -05:00
Anmol Sethi 9efcf7f3ce
FAQ.md: Document wds problem with create-react-app and pathProxy.ts 2021-01-20 02:06:43 -05:00
Anmol Sethi ba4a24809c
routes/index.ts: Correctly register wsErrorHandler
express requires all 4 arguments to be declared for a error handler.
It's very unfortunate that our types do not handle this.
2021-01-20 02:06:43 -05:00
Anmol Sethi 497b01bffe
FAQ.md: Document --proxy-path-passthrough
And the concerns surrounding it.

Closes #2485
2021-01-20 02:06:43 -05:00
Anmol Sethi f169e3ac66
pathProxy.ts: Implement --proxy-path-passthrough
Closes #2222
2021-01-20 02:06:43 -05:00
Anmol Sethi c17f3ffc79
Merge pull request #2596 from cdr/rdbeach
vscode.ts: Fix close current folder
2021-01-20 01:59:12 -05:00
Anmol Sethi d234ddc1e1
vscode.ts: Fix close current folder
Fixes VscodeProvider to correctly obey the ew parameter.

Based on changes by @rdbeach. See the previous commit.
2021-01-18 11:29:18 -05:00
Robert Beach 28c7340608
Fix Close Folder/Workspace (#2532)
When you choose to close the current folder, it doesn't close properly
because the lastVisiited setting is still use. This fixes that.
2021-01-18 11:28:29 -05:00
Joe Previte 3394ece107
Merge pull request #2501 from cdr/issue-2132-help-info-extension-search-view
feat(extensions): add helper header above extensions search
2021-01-14 16:30:28 -07:00
Joe Previte 500ba92466
fix: style links with correct colors 2021-01-14 22:40:33 +00:00
Joe Previte d9508946b5
feat: add helper header above extensions search
Add a short message above the search box on the Extensions panel. This
helps explain the extension divergence to the user.

If they click dismiss, it stores an item in localStorage to prevent the
message from showing up on subsequent loads.

Co-authored-by: Asher <ash@coder.com>
2021-01-14 22:40:19 +00:00
SPGoding eae285cf93
Improve hashed-password FAQ (#2533) 2021-01-14 13:00:52 -06:00
Asher 39faceeee4
Merge pull request #2539 from cdr/callback-html 2021-01-11 16:19:08 -06:00