Commit Graph

544 Commits

Author SHA1 Message Date
Asher Gomez
b555d43e6b
fix(http): serve swallows errors when Response.body has already been consumed (#2702) 2022-09-28 11:15:52 -04:00
Yoshiya Hinosawa
a08e42db01
fix(http/file_server): serveFile returns 404 when the path is directory (#2659) 2022-09-15 10:34:22 -04:00
Tim Reichen
2f7713a164
chore(tools): add deprecation check (#2613) 2022-09-15 16:06:04 +09:00
Asher Gomez
3b9fb39ddd
chore: remove void and Promise<void> return types (#2550) 2022-08-24 10:21:57 +09:00
Kitson Kelly
d3ee523011
feat(http): add CookieMap and SecureCookieMap (#2502) 2022-08-22 18:27:31 +10:00
Asher Gomez
237cc49f8b
feat(http/file_server): return 404 response if file not found (#2529) 2022-08-16 14:49:38 +09:00
Asher Gomez
822898d8b3
docs: removed types from jsdoc directives (#2515) 2022-08-13 23:53:23 +09:00
Asher Gomez
11819ce656
feat(http/cookie): add set-cookie headers parser (#2475) 2022-08-13 23:49:25 +09:00
JongChan Choi
f693ad60d4
feat(http): support cert, key options in serveTls (#2508) 2022-08-13 22:44:50 +09:00
Kitson Kelly
e83306672e
docs: improve module documentation (#2511) 2022-08-11 21:51:20 +10:00
Timo Rossa
c99fe6923b
feat(http/http_errors): add headers property (#2462)
Closes: #2451
2022-07-26 14:28:47 +10:00
Bartek Iwańczuk
c2a8951c04
chore: update to changes in spawn API (#2448) 2022-07-19 02:35:19 +02:00
Kitson Kelly
2a02009d42
feat(http): add content negotiation (#2302) 2022-07-04 17:26:56 +10:00
Kitson Kelly
5f0eb925d8
feat(http): add HTTP errors (#2307) 2022-07-04 16:40:11 +10:00
Timo Rossa
b5a32c6e44
fix(http): Disable console.error if opts.quiet is true (#2379)
Disable `console.error` if `opts.quiet` is true
2022-06-23 10:00:18 -04:00
Benjamin Fischer
45cf7717ec
feat(flags): infer argument types, names and defaults (#2180) 2022-06-21 15:36:51 +09:00
Sơn Trần-Nguyễn
c83dc62932
refactor(http/file_server): uniform status & statusText (#2361) 2022-06-17 12:26:44 +09:00
Sơn Trần-Nguyễn
c7484ff14b
docs(http/file_server): fix comment for mtime (#2350) 2022-06-16 15:21:32 +09:00
Bartek Iwańczuk
a06298b0b5
chore: Update top level module JSDocs (#2343)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2022-06-14 11:20:56 +02:00
Benjamin Fischer
762c47a93c
BREAKING(flags): introduce negatable option (#2301) 2022-06-09 13:06:36 +09:00
Ruslan Tushov
bcc5747842
fix: pass resolved ephemeral port to onListen (#2311)
Pass resolved ephemeral port to onListen instead of 0.
2022-06-07 08:33:09 -04:00
Kitson Kelly
6df7747014
BREAKING feat(http): improve type safety and docs for http_status (#2297)
`STATUS_TEXT` is now just a record object instead of a map, which provides more utility for less overhead.
2022-06-03 11:21:43 +10:00
Kitson Kelly
71054ecf7f
refactor(http): file_server uses std/media_types (#2298) 2022-06-03 09:30:02 +10:00
ayame113
b3b6f944dd
chore(http/file_server): export interface for serveDir/serveFile (#2293)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-01 23:56:57 +09:00
Yoshiya Hinosawa
034c6e2833
test: fix unhandled promises in test cases (#2281) 2022-05-29 21:02:37 +09:00
Leo Kettmeir
852968f631
refactor: switch the Deno.spawn (#2161) 2022-05-25 11:08:27 +02:00
Yoshiya Hinosawa
d6bdd62390
feat(http/util): add compareEtag (#2259) 2022-05-23 13:53:16 +09:00
masx200
3403116ca9
fix(http/file_server): fix handling of 'W/' prefixed etag (#2229) 2022-05-16 22:24:11 +09:00
Yoshiya Hinosawa
629a458845
feat(http): add onListen option to serve (#2218) 2022-05-16 20:39:29 +09:00
like-nanhai
c75454c44b
docs: add module level docs (#2190) 2022-05-04 19:34:37 +09:00
Bartek Iwańczuk
d85a348f97
test(http): add catch handler to server promise (#2178) 2022-05-03 15:58:28 +02:00
Timo Rossa
0e74e21965
fix(http): export interface ServeTlsInit (#2148) 2022-04-24 21:20:56 +09:00
Ryan Dahl
3b7aca1842
http: serve() should log where it is listening (#1641)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2022-04-22 16:15:44 -04:00
Divy Srivastava
ec966d3de6
chore(http): update file_server tests w.r.t. stream compression (#2133) 2022-04-21 18:29:34 +05:30
Jayden Seric
8c05217c5a
fix(http): use the addEventListener method instead of onabort properties (#2124) 2022-04-20 13:49:22 +09:00
Divy Srivastava
f62ef207f2
perf(http): optimize file server (#2116) 2022-04-18 08:11:11 +05:30
Yoshiya Hinosawa
b36f8a41b7
fix(node/http): ignore error from respondWith (#2058) 2022-03-24 01:19:00 +09:00
Jesse Jackson
58204e6f56
refactor: mark modules as browser compatible (#1972) 2022-03-01 13:25:50 +09:00
Yoshiya Hinosawa
936a8cf4d6
feat(http): expose serveDir function from file_server.ts (#1944) 2022-02-22 11:06:26 +09:00
Bartek Iwańczuk
658340bad4
fix: http/_mock_conn.ts (#1926) 2022-02-15 17:38:18 +01:00
Ryan Dahl
3b43d075ea
0.125.0
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-02-03 23:46:48 +01:00
Yoshiya Hinosawa
808fe203e0
chore: update copyright header (#1871) 2022-02-02 23:21:39 +09:00
Yoshiya Hinosawa
c331dad1df
chore: update mock Deno.Conn (#1867) 2022-02-01 18:28:05 +09:00
Luca Casonato
f0506f5d79
chore(http/file_server): only seek if necessary (#1836)
Minor peformance optimization.
2022-01-21 13:30:56 +01:00
Bartek Iwańczuk
f4e0d45590
chore: tweak server examples (#1822) 2022-01-13 18:33:00 +01:00
Bartek Iwańczuk
4d3094c935
feat(http): add eyecandy to file_server (#1804) 2022-01-09 02:51:55 +01:00
Erfan Safari
38b0a9f874
feat(http/file_server): add 'quiet' flag (#1773)
Fixes #1768.
2022-01-07 11:03:20 +01:00
Bartek Iwańczuk
efa94f2ccc
fix: http/bench.ts (#1776) 2022-01-02 12:02:20 +01:00
Jonas Grunert
251ad20639
BREAKING(http): remove Go-style address (#1660)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Craig Morten <cmorten@users.noreply.github.com>
2021-12-14 00:38:32 +09:00
Bartek Iwańczuk
3f6263547e
[BREAKING] Remove 'server_legacy' from 'http' module (#1648) 2021-12-13 14:18:17 +01:00
Bartek Iwańczuk
dcad2062d5
[BREAKING] Remove assertThrowsAsync from 'testing/' (#1646) 2021-12-13 14:00:20 +01:00
Yoshiya Hinosawa
3a441de21a
test(http): fix error message of unknown issuer (#1681) 2021-12-07 21:46:24 +09:00
Kyle Warren
bfd6356f9c
feat(http): add onError option to serveListener and serveTls (#1679) 2021-12-07 11:58:43 +09:00
Satya Rohith
04a55c008a
feat(http): introduce onError option on ServerInit (#1621) 2021-12-01 19:11:31 +05:30
Yuki Tanaka
d14d829b44
chore(http/file_server): migrate to serve and serveTls (#1566) 2021-11-14 14:17:19 +01:00
vwkd
cb1c296731
fix(http): update README (#1546) 2021-11-10 14:31:32 +01:00
Luca Casonato
9d6d654a6c
0.114.0 2021-11-09 14:53:18 +01:00
Yoshiya Hinosawa
15c7868e1d
BREAKING(http): update serve, add serveListener, deprecate listenAndServe (#1506) 2021-11-09 12:24:09 +09:00
Yoshiya Hinosawa
cd92997b2c
fix(http/file_server): don't require --allow-read for showing help message (#1521) 2021-11-04 19:22:55 +09:00
Yoshiya Hinosawa
03b1af798f
refactor(http/file_server): use default and alias feature of flag parser (#1512) 2021-11-04 00:02:41 +09:00
Yoshiya Hinosawa
a18d4996c0
refactor(http/file_server): remove html template literal tag (#1513) 2021-11-03 21:50:00 +09:00
Yoshiya Hinosawa
8c41818eb9
test(http/file_server): skip type checking in each test case (#1514) 2021-11-03 17:11:19 +09:00
Tommy Josépovic
e563b562d0
feat(http/file_server): add streaming support, fix empty file handling (#1479) 2021-10-28 17:08:18 +09:00
ayame113
9e23e1c82e
docs(http/http_status): add documents for http_status.ts (#1451) 2021-10-24 14:05:22 +09:00
vi117
41ad7cebeb
fix(http/file_server): fix leak file resource (#1443) 2021-10-22 17:11:43 +09:00
vi117
fb35d70347
fix(http/file_server): fix encoded url in dir html (#1442) 2021-10-22 15:30:16 +09:00
xiao xigua
efd75836be
feat(http/file_server): add color to log message (#1434) 2021-10-21 03:08:19 +09:00
xiao xigua
74b4a2c447
feat(http/file_server): add breadcrumbs navigation (#1433) 2021-10-20 17:04:32 +09:00
ayame113
bbe2271bad
test(http/server): add a test case for the combination of Deno.upgradeWebSocket() and listenAndServe() (#1324) 2021-10-19 02:12:26 +09:00
Yoshiya Hinosawa
a4730dea0d
chore: fmt (#1393) 2021-10-13 20:38:54 +09:00
Leo K
b58b10c229
feat: streams utilities (#1141) 2021-10-12 11:51:48 +02:00
Nayeem Rahman
d21aa79126
BREAKING(io): Reorganize modules (#813)
This commit reogranizes many modules:
- Move exports of io/bufio.ts (removed) into io/buffer.ts.
- Move exports of io/util.ts (repurposed, see next bullet) into io/streams.ts.
* With the exception of readRange() and readRangeSync(), which have been moved to io/files.ts (new).
*Also rename iter() and iterSync() to iterateReader() and iterateReaderSync() respectively.
- Move exports of io/ioutil.ts (removed) into io/util.ts.

Deprecation messages were added to old modules to make this change backwards compatible.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2021-10-08 03:42:33 +02:00
Bartek Iwańczuk
44c326dc5b
fix: update to latest signal API changes (#1211) 2021-09-15 01:32:26 +02:00
Yasser A.Idrissi
e52ee67e42
docs(http/cookie): improve jsdoc (#1231) 2021-09-13 19:20:06 +09:00
Tim Reichen
63f22aa880
BREAKING(http): cookie headers as params (#1041) 2021-09-13 15:16:16 +09:00
Craig Morten
7f8335449a
docs: reduce friction for windows users r.e. 0.0.0.0 (#1210) 2021-09-07 16:29:44 +09:00
Craig Morten
dd718b9fa6
docs(http): adhere to deno style guide in std/http module (#1202) 2021-09-06 17:06:59 +09:00
Craig Morten
0fc3b2e75e
feat(http): implement native HTTP server APIs (#1128) 2021-08-31 10:36:30 -04:00
Kitson Kelly
b7c61a27a7
chore: updates related to TypeScript 4.4 (#1171)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2021-08-31 14:39:04 +10:00
Behnam Mohammadi
1a346417fd
refactor: use os util on entire of codebase (#1123) 2021-08-13 11:11:14 +09:00
Ryan Dahl
455077a905
fix: type check examples in README files (#1121)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-08-11 11:28:10 +02:00
Yasser A.Idrissi
eb69dbd380
feat(testing): add assertRejects, deprecate assertThrowsSync (#1101) 2021-08-09 14:59:52 +09:00
Yuki Tanaka
0ffdf9c6ed
fix(http/file_server): fix flaky 'file_server sets Date header correctly' test case (#1095) 2021-08-05 00:34:15 +09:00
timonson
5efcc78827
feat(http/file_server): return code 304 based on If-Modified-Since Header (#1078) 2021-08-03 15:58:31 +09:00
Yasser A.Idrissi
2c26f0673f
test(http): fix flaky file_server test (#1059) 2021-07-23 22:16:52 +09:00
Yoshiya Hinosawa
186354327c
chore: enable doc type checking (#1050) 2021-07-23 19:09:38 +09:00
Paul Ellis
0722cd0770
feat(http): add range request and etag support to file_server.ts (#1028) 2021-07-22 15:12:40 +09:00
Luca Casonato
81314bcab8
feat: add copy util to std/io (#1016)
This is in preparation of deprecation in Deno, and removal in Deno 2.0.
2021-07-12 14:46:07 +02:00
Yasser A.Idrissi
3f446475be
feat(http): Add Cookie domain validation (#1009)
Cookie domain should not start with - and end with . or -.
https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.2.3
2021-07-08 13:19:10 -04:00
Yasser A.Idrissi
6f62e9c271
docs(http): add deleteCookie options documentation (#1007) 2021-07-08 17:11:19 +09:00
Yasser A.Idrissi
d8e61e4768
feat(http): Allow passing path and domain attributes while removing cookies (#1005) 2021-07-06 20:57:35 +02:00
Nayeem Rahman
7c3f017d3b
fix(http/server): Swallow NotConnected errors from listener.accept() (#761) 2021-07-06 17:47:06 +02:00
Simon Rask
f3828fa852
fix: setCookie with maxAge of 0 (#992) 2021-06-30 14:02:22 -04:00
Yasser A.Idrissi
c8d492017f
docs(hash,http): add module descriptions (#934) 2021-05-25 13:05:32 +09:00
Luca Casonato
db348ae388
fix: bad assumption about tls in server tests (#915)
This commit fixes a bad assumption that `connectTls` will throw on a
handshaking error. Really the TLS conn will only fail on first read or
write.
2021-05-11 22:33:28 +02:00
Simon Lecoq
1b4eff019b
feat(http): allow custom response code (#855) 2021-05-11 17:05:00 +09:00
木杉
b850d01991
fix(http/file_server): keep url and name consistent (#908)
Add trailing slash to href on directories to match the name displayed on screen.
2021-05-10 09:29:26 -04:00
Yasser A.Idrissi
a2ea1bc67f
ref(http): Remove Cookie from validation function name (#893) 2021-05-06 08:50:40 -04:00
Ryan Dahl
71fd34c099
Fix test after Headers API was made spec compliant (#865) 2021-04-20 12:19:18 -04:00
Luca Casonato
564b44f68a
feat: add iter and iterSync to io/util (#843)
This moves the `Deno.iter` and `Deno.iterSync` implementations to std,
so we can deprecate them in Deno 1.9, and remove them in Deno 2.0.
2021-04-11 13:53:30 +02:00
William Perron
69f3d67cb2
chore: remove Promise<void> return type annotation (#819)
There's a couple of instances where `Promise<void>` is still there,
those are the exceptions, for example functions that explicitely return
a `Promise` object or functions that return the promise from another
function call without any `await` statement.

used this one-liner to automatically remove everything:

```bash
grep -rli 'promise<void>' | xargs sed -i 's/: Promise<void>//g
```
2021-04-05 07:49:05 -04:00
Yasser A.Idrissi
7c15717af7
fix(http): Remove unused readAll import (#817) 2021-03-25 09:37:01 -04:00
Luca Casonato
be89f5a714
feat: add io/buffer and io/util module (#808)
This moves the `Deno.Buffer` and `Deno.readAll` / `Deno.readAllSync` /
`Deno.writeAll` / `Deno.writeAllSync` implementations to std, so we can
deprecate them in Deno 1.9, and remove them in Deno 2.0.
2021-03-22 22:45:35 +01:00
Rustam
27dcc84ae1
fix: encoder/decoder one instance (#790)
Fixes #788
2021-03-08 09:19:42 +10:00
Yusuke Tanaka
b134d54319
refactor: fix codes to pass no-unused-vars lint (#764) 2021-03-02 15:31:37 +09:00
Zhangyuan Nie
5bc18f5d86
BREAKING(encoding): remove module utf8.ts (#728) 2021-02-16 13:22:07 +01:00
Casper Beyer
07050a8760
BREAKING(http/cookie): remove Cookies and SameSite type aliases (#720) 2021-02-12 11:59:54 +01:00
Fons van der Plas
2b14db30da
fix(http/file_server): svg media type (#718) 2021-02-11 09:08:00 +11:00
木杉
5707b9b2ed
feat(http/file_server): support do not show dotfiles (#690) 2021-02-02 14:36:52 -05:00
木杉
715d53e272
feat(http/file_server): show ../ if it makes sense & end dirs with / (#691) 2021-02-02 12:01:21 +01:00
Casper Beyer
d5bad95a71
chore: Setup CI and tests
Create ci.yml

chore: add wasi-test-suite as a submodule

chore: remove legacy configuration files and scripts

chore: remove outdated redirection notice

chore: add git attributes to ensure text files use unix line endings

chore: format

test(http): copy tls testdata from denoland/deno
2021-02-01 12:20:35 +01:00
Bert Belder
e2870f39bf refactor: IO resource types, fix concurrent read/write and graceful close (denoland/deno#9118)
Fixes: 9032.
2021-02-01 10:46:59 +00:00
Luca Casonato
5c1f86e63e Revert "tests: enable wpt for url (denoland/deno#9046)" (denoland/deno#9264)
This reverts commit 66e99d349b31f5cd30b868d80ebdab6ba749fd96.
2021-02-01 10:46:59 +00:00
Luca Casonato
f7b62f11d3 tests: enable wpt for url (denoland/deno#9046) 2021-02-01 10:46:59 +00:00
Bartek Iwańczuk
84ee144ba8 chore: Enforce ban-untagged-todo lint rule (denoland/deno#9135) 2021-02-01 10:46:59 +00:00
Ryan Dahl
48a2496dbe update copyright to 2021 (denoland/deno#9081) 2021-02-01 10:46:59 +00:00
Zhangyuan Nie
8528b86712 fix(http): Use ES private fields in server (denoland/deno#8981) 2021-02-01 10:46:58 +00:00
Noxazer
87fa655c12 fix(http): parsing of HTTP version header (denoland/deno#8902) 2021-02-01 10:46:58 +00:00
Nayeem Rahman
8e8d672d75 fix(http): Don't expose ServerRequest::done as Deferred (denoland/deno#8919) 2021-02-01 10:46:58 +00:00
Yasser A.Idrissi
9c9982a60f feat(http): Add Cookie value validation (denoland/deno#8471) 2021-02-01 10:46:58 +00:00
sarahdenofiletrav
a7558b92ff fix(http): prevent path traversal (denoland/deno#8474)
Fix path traversal problem when the request URI 
does not have a leading slash.

The file server now returns HTTP 400 when requests 
lack the leading slash, and are not absolute URIs. 
(https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html).
2021-02-01 10:46:58 +00:00
Yasser A.Idrissi
a1ba678504 feat(http): Validate cookie path value (denoland/deno#8457) 2021-02-01 10:46:58 +00:00
Yasser A.Idrissi
d0290cd7a1 refactor(http): Rename validateCookieName param name & JSDoc (denoland/deno#8451) 2021-02-01 10:46:58 +00:00
Bartek Iwańczuk
4379f0a9c1 test: make test output less noisy (denoland/deno#8445)
This commit makes output of  tests less noisy
by passing "--quiet" flag to Deno subprocesses run
as part of test suite.
2021-02-01 10:46:58 +00:00
William Perron
0ea945721b docs: add missing jsdoc comments to exported functions (denoland/deno#8442)
includes:
- http/file_server.ts
- testing/_diff.ts
- testing/asserts.ts

Relates to denoland/deno#7487
2021-02-01 10:46:58 +00:00
lideming
53fc2a46ed fix(http): fix error handling in the request iterator (denoland/deno#8365)
If the request body is using chunked encoding, errors may 
be thrown in "request.finalize()".

In this case, we should untrack and close the connection.
2021-02-01 10:46:58 +00:00
Yasser A.Idrissi
39513d8750 feat(http): Check if cookie property is valid (denoland/deno#7189)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2021-02-01 10:46:58 +00:00
Mark Tiedemann
e755eeefe0 fix(http): flush body chunks for HTTP chunked encoding (denoland/deno#8349)
Fixes denoland/deno#8339
2021-02-01 10:46:58 +00:00
Luca Casonato
701513431e fix: path traversal in http/file_server.ts (denoland/deno#8134) 2021-02-01 10:46:58 +00:00
Tim Reichen
55a7adb58e rename(testing): rename assert*Contains to assert*Includes (denoland/deno#7951)
This commit renames two assertion functions to better align with JS API:
- assertStringContains -> assertStringIncludes
- assertArrayContains -> assertArrayIncludes
2021-02-01 10:46:58 +00:00
uki00a
cd668cb3f3 fix(http/file_server): File server should ignore query params (denoland/deno#8116) 2021-02-01 10:46:58 +00:00
Max Drosdo.www
b79a6a5644 docs: fix command examples use outdated default file_server port (denoland/deno#8062) 2021-02-01 10:46:58 +00:00
tokiedokie
8567b960f8 docs: version all imports in README (denoland/deno#7442)
Use $STD_VERSION in  README files to automatically
display proper version.
2021-02-01 10:46:58 +00:00
tokiedokie
fe5fcfc0d4 chore(http): rename http_bench.ts -> bench.ts (denoland/deno#7509) 2021-02-01 10:46:58 +00:00
Trivikram Kamat
eb1c38cfbf docs: end sentences with a period in markdown (denoland/deno#7813) 2021-02-01 10:46:58 +00:00
David Sherret
99e0dca320 feat(fmt): Sort named import and export specifiers (denoland/deno#7711) 2021-02-01 10:46:58 +00:00
tokiedokie
d3fa1bbf5d chore: add copyright (denoland/deno#7593) 2021-02-01 10:46:58 +00:00
Bartek Iwańczuk
79b74fd50d chore: reenable disabled test in (denoland/deno#7578) 2021-02-01 10:46:58 +00:00
Bartek Iwańczuk
6862d1b79f refactor: deno_fetch op crate (denoland/deno#7524) 2021-02-01 10:46:58 +00:00
Ryan Dahl
360d022b44 refactor: make fetch use op_fetch_read instead of op_read (denoland/deno#7529) 2021-02-01 10:46:58 +00:00
Casper Beyer
75572fe4c5 test(http): make tests runnable from any directory (denoland/deno#7441)
This makes http tests runnable from any directory by spawning test
processes in the module directory resolved from import.meta.url and
resolving test data relative to the same module directory.
2021-02-01 10:46:58 +00:00
Casper Beyer
5a34e26c91 test: ensure mod.ts modules have a test coverage (denoland/deno#7264) 2021-02-01 10:46:58 +00:00
木杉
5097b05ecc feat(http): add --no-dir-listing flag to file_server (denoland/deno#6808) 2021-02-01 10:46:58 +00:00
Alberto Ricart
163ace4e50 feat: added TLS serve abilities to file_server (denoland/deno#6962) 2021-02-01 10:46:58 +00:00
Trivikram Kamat
6f30c8bd57 test: remove unstable from multiple tests (denoland/deno#6882) 2021-02-01 10:46:58 +00:00
David Sherret
1425960509 Use dprint for internal formatting (denoland/deno#6682) 2021-02-01 10:46:58 +00:00
Nayeem Rahman
3373772143 fix(cli/js/web/url): Implement IPv4 hostname parsing (denoland/deno#6707) 2021-02-01 10:46:58 +00:00
KrisChambers
2cda6fbd3c Fix for issue denoland/deno#6685: --allow-net=:8080 broken (denoland/deno#6698) 2021-02-01 10:46:58 +00:00
Evan Bertrand
4d796ea4ae fix(http): properly return port 80 in _parseAddrFromStr (denoland/deno#6635) 2021-02-01 10:46:58 +00:00
Kitson Kelly
7af23788ef Update http/cookie types to not require full ServerRequest object (denoland/deno#6577) 2021-02-01 10:46:58 +00:00
Oron Sharabi
a32368803d fix(http): Support ipv6 parsing (denoland/deno#5263) 2021-02-01 10:46:58 +00:00
Jim van der Voort
9dc1baf960 fix(http): Catch errors on file_server response.send (denoland/deno#6285) 2021-02-01 10:46:58 +00:00
Stanislav
4e7381777b docs: replace delCookie with deleteCookie (denoland/deno#6467) 2021-02-01 10:46:58 +00:00
Nayeem Rahman
ccb92613f0 refactor: Don't destructure the Deno namespace (denoland/deno#6268) 2021-02-01 10:46:58 +00:00
Ryan Dahl
f8eb45e39d make std deno-lint clean (denoland/deno#6240)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-02-01 10:46:58 +00:00
Nayeem Rahman
5f730eacff fix(cli/js/process): Strengthen socket types based on pipes (denoland/deno#4836) 2021-02-01 10:46:57 +00:00
Marcos Casagrande
dce2ff677a fix(http/server): flaky test on Windows (denoland/deno#6188) 2021-02-01 10:46:57 +00:00
Marcos Casagrande
5c85fe6bcb fix(http): Prevent crash on UnexpectedEof and InvalidData (denoland/deno#6155) 2021-02-01 10:46:57 +00:00
Chris Knight
589fe4bd53 refactor: remove testing dependencies from non-test code (denoland/deno#5838) 2021-02-01 10:46:57 +00:00
Tim Reichen
c2f9a73439 refactor(http): rename delCookie to deleteCookie (denoland/deno#6088) 2021-02-01 10:46:57 +00:00
Casper Beyer
eb9127bf38 Rename abbreviated assertions in testing (denoland/deno#6118) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
6eb0618784 fix(http): Don't use assert() for user input validation (denoland/deno#6092) 2021-02-01 10:46:57 +00:00
matheus
71b4a4eda0 fix(http/file_server): args handling only if invoked directly (denoland/deno#5989) 2021-02-01 10:46:57 +00:00
simwipado
42a360a752 fix(http): file server not closing files (denoland/deno#5952) 2021-02-01 10:46:57 +00:00
Yasser A.Idrissi
9d114c820c feat(http) support code 103 Early Hints (denoland/deno#6021) 2021-02-01 10:46:57 +00:00
Voltra
953e7ee26a feat(http): add TooEarly status code (denoland/deno#5999)
As per [RFC 8470 5.2](https://tools.ietf.org/html/rfc8470#section-5.2)
2021-02-01 10:46:57 +00:00
Yusuke Sakurai
319cb909df fix: readTrailer didn't evaluate header names by case-insensitive (denoland/deno#4902) 2021-02-01 10:46:57 +00:00
Chris Knight
3d0b743cfe doc: improve documentation for consuming request body (denoland/deno#5771) 2021-02-01 10:46:57 +00:00
Stephan Seidt
86dc7ce174 Fix shebangs (denoland/deno#5898) 2021-02-01 10:46:57 +00:00
Stephan Seidt
7fa1002c52 Add wasm to media types (denoland/deno#5896) 2021-02-01 10:46:57 +00:00
Robin Wieruch
a321ed2ab1 improve docs (denoland/deno#5873) 2021-02-01 10:46:57 +00:00
Kitson Kelly
96502a4db0 Use ts-expect-error instead of ts-ignore. (denoland/deno#5869) 2021-02-01 10:46:57 +00:00
moyinzi
0710fc09ca fix(http): file_server's target directory (denoland/deno#5695) 2021-02-01 10:46:57 +00:00
Bert Belder
d1dbf9be98 Miscellaneous documentation and spelling improvements (denoland/deno#5527)
* Extended/updated documentation on code editor setup and plugins.
* Moved documentation to the right file.
* Fixed spelling errors in documentation and code.
* Updated broken links.

Co-authored-by: 迷渡 <justjavac@gmail.com>
Co-authored-by: AlfieriChou <alfierichou@gmail.com>
Co-authored-by: Anil Seervi <anil13112000@gmail.com
Co-authored-by: Bert Belder <bertbelder@gmail.com>
Co-authored-by: Fernando Basso <fernandobasso.br@gmail.com>
Co-authored-by: József Sallai <jozsef@sallai.me>
Co-authored-by: S4ltyGo4t <mario.weidner@gmx.de>
Co-authored-by: Tommy May <tommymay37@gmail.com>
Co-authored-by: Turbinya <wownucleos@gmail.com>
Co-authored-by: ᴜɴвʏтᴇ <i@shangyes.net>
2021-02-01 10:46:57 +00:00
Ali Hasani
3f7c8d7bca Implement Deno.kill for windows (denoland/deno#5347) 2021-02-01 10:46:57 +00:00
Mike Nikles
842f5b4041 Add .css to the MEDIA_TYPES. (denoland/deno#5367) 2021-02-01 10:46:57 +00:00
Bert Belder
53cf4e5997 Fix flakiness in std file_server tests (denoland/deno#5306)
Fixes: denoland/deno#5275
2021-02-01 10:46:57 +00:00
Ryan Dahl
c8da66cb74 BREAKING: There is no public Rust API for the CLI (denoland/deno#5226) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
1eecc5c7d0 BREAKING: reorganization (denoland/deno#5087)
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move _util/async.ts to async
* Move util/sha*.ts to hash
2021-02-01 10:46:57 +00:00
zjopy
562225a19c fix(docs): add missing "deno run" (denoland/deno#5126) 2021-02-01 10:46:57 +00:00
Ryan Dahl
2bbc212aa8 stabilize Deno.cwd and require --allow-read (denoland/deno#5068) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
7275cf7ace BREAKING: feat(cli/installer): Support guessing the executable name (denoland/deno#5036) 2021-02-01 10:46:57 +00:00
木杉
666c2484b2 fix(http): avoid directly modifying the headers object (denoland/deno#5024) 2021-02-01 10:46:57 +00:00
Luca Casonato
94e6c3d329 Unstable methods should not appear in runtime or d.ts (denoland/deno#4957)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-02-01 10:46:57 +00:00
Ryan Dahl
975115fb15 make camel case readDir, readLink, realPath (denoland/deno#4995) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
380f7e971b BREAKING: remove custom implementation of Deno.Buffer.toString() (denoland/deno#4992)
Keep in mind Buffer.toString() still exists, but returns [object Object]. 

Reason for removal of Buffer.toString() was that it implicitly used 
TextDecoder with fixed "utf-8" encoding and no way to customize 
the encoding.
2021-02-01 10:46:57 +00:00
Bert Belder
5cc4e45d69 BREAKING: Include limited metadata in 'DirEntry' objects (denoland/deno#4941)
This change is to prevent needed a separate stat syscall for each file
when using readdir.

For consistency, this PR also modifies std's `WalkEntry` interface to
extend `DirEntry` with an additional `path` field.
2021-02-01 10:46:57 +00:00
David Sherret
bd3e3f875a Move the docs like @param [obj.prop] to the interface. (denoland/deno#4974) 2021-02-01 10:46:57 +00:00
Ryan Dahl
9eadc896bf Remove Conn.closeRead (denoland/deno#4970) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
e4cb19d01d BREAKING: Remove Deno.EOF, use null instead (denoland/deno#4953) 2021-02-01 10:46:57 +00:00
Ryan Dahl
bdac502f84 BREAKING: Use LLVM target triple for Deno.build (denoland/deno#4948)
Deno.build.os values have changed to correspond to standard LLVM target triples
"win" -> "windows"
"mac" -> "darwin"
2021-02-01 10:46:57 +00:00
迷渡
64d47b114d typo (denoland/deno#4962) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
4facff44f2 BREAKING: remove overload of Deno.test() (denoland/deno#4951)
This commit removes overload of Deno.test() that accepted named
function.
2021-02-01 10:46:57 +00:00
Marcos Casagrande
3d0a60f1dd Improve http/io.ts parseHTTPVersion (denoland/deno#4930) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
214d4bf8e4 BREAKING CHANGE: change order of args in Deno.copy() (denoland/deno#4885) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
f783fe923d BREAKING CHANGE: rename TLS APIs to camel case (denoland/deno#4888)
This commit renames all APIs containing "TLS" to use camel case
(connectTLS -> connectTls, etc.)
2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
b1e5c283d9 BREAKING CHANGE: rename Deno.toAsyncIterator() to Deno.iter() (denoland/deno#4848)
* rename Deno.toAsyncIterator() to Deno.iter()
* adds sync version Deno.iterSync()
* adds optional second argument for buffer size
2021-02-01 10:46:57 +00:00
Nayeem Rahman
b10a0edb43 refactor(cli/js/ops/fs): Improve readdir() and FileInfo interfaces (denoland/deno#4763) 2021-02-01 10:46:57 +00:00
木杉
407fb3fd73 fix(http): verify cookie name & update SameSite type (denoland/deno#4685) 2021-02-01 10:46:57 +00:00
Ryan Dahl
877b8a037a BREAKING: Make fetch API more web compatible (denoland/deno#4687)
- Removes the __fetch namespace from `deno types`
- Response.redirect should be a static.
- Response.body should not be AsyncIterable.
- Disables the deno_proxy benchmark
- Makes examples/curl.ts buffer the body before printing to stdout
2021-02-01 10:46:57 +00:00
木杉
e6635642b2 file_server: use text/typescript instead of application/typescript (denoland/deno#4620)
I just tried it and found that using application/typescript, the browser will download 
the file directly, I think that .ts should be mapped to application/javascript or 
text/typescript
2021-02-01 10:46:57 +00:00
Nayeem Rahman
92198ca168 feat(http/server): Respond with 400 on request parse failure (denoland/deno#4614) 2021-02-01 10:46:57 +00:00
Ryan Dahl
36bf5ba4ed Remove /media_types (denoland/deno#4594) 2021-02-01 10:46:57 +00:00
Ryan Dahl
ddd9b90e8a Revert "Respond with 400 on request parse failure" (denoland/deno#4593)
readRequest should not write a response.

This reverts commit 017a611131a35ccf5dbfce6a2a665fa569e32ec1.
2021-02-01 10:46:57 +00:00
Ryan Dahl
1f1818d379 Move encode, decode helpers to /encoding/utf8.ts, delete /strings/ (denoland/deno#4565)
also removes encoding/mod.ts and archive/mod.ts which are useless.
2021-02-01 10:46:57 +00:00
Khải
33d074d82a fix(file_server): use media_types for Content-Type header (denoland/deno#4555) 2021-02-01 10:46:57 +00:00
木杉
3159118cf6 fix(denoland/deno#4550): setCookie should append cookies (denoland/deno#4558) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
28fadadb98 feat(http/server): Respond with 400 on request parse failure (denoland/deno#4551) 2021-02-01 10:46:57 +00:00
Kitson Kelly
7914eae5f0 Update to Prettier 2 and use ES Private Fields (denoland/deno#4498) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
21871250b8 Revert "avoid using same port number for test (denoland/deno#4147)"
Ref denoland/deno#4467

This reverts commit 60cee4f045778777a16b6fffd6d5b9a1400d7246.
2021-02-01 10:46:57 +00:00
Akshat Agarwal
fc96083668 BREAKING CHANGE Rename Deno.run's args to cmd (denoland/deno#4444)
This is to avoid confusion with Deno.args which does not include the 
executable to be run.
2021-02-01 10:46:57 +00:00
Yusuke Sakurai
c915706df7 avoid using same port number for test (denoland/deno#4147) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
d1ff7adb03 refactor(http/server): Remove bad error handling (denoland/deno#4435) 2021-02-01 10:46:57 +00:00
Samrith Shankar
204ebc523d Add require-await lint rule (denoland/deno#4401) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
357b560756 fix(http): Properly await ops in a server test (denoland/deno#4436) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
d977bf43d0 fix(http): Fix respond error test on Windows (denoland/deno#4408) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
a43f186cb0 std(http/server): close open connections on server close (denoland/deno#3679)
Due to structure of "Server" for each open connection there's a pending "read" op. Because connection owned by "Server" are not tracked, calling "Server.close()" doesn't close open connections.

This commit introduces simple tracking of connections for server and ensures owned connections are closed on "Server.close()".
2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
03d7177ca3 refactor: rename Deno.TestDefinition.skip to ignore (denoland/deno#4400) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
a19e660a30 feat: Deno.test() sanitizes ops and resources (denoland/deno#4399)
This PR brings assertOps and assertResources sanitizers to Deno.test() API.

assertOps checks that test doesn't leak async ops, ie. there are no unresolved
promises originating from Deno APIs. Enabled by default, can be disabled using 
Deno.TestDefinition.disableOpSanitizer.

assertResources checks that test doesn't leak resources, ie. all resources used
in test are closed. For example; if a file is opened during a test case it must be
explicitly closed before test case finishes. It's most useful for asynchronous
generators. Enabled by default, can be disabled using 
Deno.TestDefinition.disableResourceSanitizer.

We've used those sanitizers in internal runtime tests and it proved very useful in
surfacing incorrect tests which resulted in interference between the tests.

All tests have been sanitized.

Closes denoland/deno#4208
2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
11460f178e refactor: add no-return-await lint rule (denoland/deno#4384) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
19ca3f53c4 refactor: Uncomment disabled tests, use skip option (denoland/deno#4378) 2021-02-01 10:46:57 +00:00
dubiousjim
635881632d BREAKING CHANGE FileInfo.len renamed to FileName.size (denoland/deno#4338) 2021-02-01 10:46:57 +00:00
Lucas De Angelis
5efaa19934 doc(http/server): Add coherence to the docs (denoland/deno#4372)
Functions that returns a server are now documented with "Create",
and functions that launches one are documented with "Start".

Also added documentation for listenAndServe that respects these
changes.

Fixes denoland/deno#4367
2021-02-01 10:46:57 +00:00
Oliver Lenehan
9986475ca1 fix: Use Deno.errors where possible. (denoland/deno#4356) 2021-02-01 10:46:57 +00:00
Nayeem Rahman
f2de470209 refactor(cli/js/net): Cleanup iterable APIs (denoland/deno#4236)
Listener and UDPConn are AsyncIterables instead of AsyncIterators.
The [Symbol.asyncIterator]()s are defined as generators and the
next() methods are gone.

"Listener/Socket has been closed" errors are now BadResource.
2021-02-01 10:46:57 +00:00
dubiousjim
28eb11d848 Rename readDir -> readdir (denoland/deno#4225) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
589ac5af6f reduce unnecessary output on tests (denoland/deno#4148) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
0e35e71503 refactor(http): move io functions to http/io.ts (denoland/deno#4126) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
761c2c1ece fix: [http] Consume unread body and trailers before reading next request (denoland/deno#3990)
- Added `ServerRequest.finalize()`:  consuming all unread body stream and trailers.
  - This is cleanup method for reading next request from same keep-alive connection.
  - Needed when handler didn't consume all body and trailers even after responding.
- refactor: `ServerRequest._bodyStream()`, `ServerRequestBody` are removed.
  - Now using `bodyReader()` and `chunkedBodyReader()` instead.
- fix: Trailers should only be read `transfer-encoding` is `chunked` and `trailer` header is set and its value is valid.
- fix: use `Headers.append()` on reading trailers.
- fix: delete `trailer` field from headers after reading trailers.
- reorg: Several functions related to IO are moved into `http/io.ts`
2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
8bd4c5ed4d rename Deno.Err -> Deno.errors (denoland/deno#4093) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
b490e1199c fix: [ws] sock shouldn't throw eof error when failed to read frame (denoland/deno#4083) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
f5cbcf287e refactor: remove unneeded ErrorKinds (denoland/deno#3936) 2021-02-01 10:46:57 +00:00
Maximilien Mellen
623a601fd5 Enable TS strict mode by default (denoland/deno#3899)
Fixes denoland/deno#3324 

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2021-02-01 10:46:57 +00:00
Yusuke Sakurai
d575a7483f fix: appended CRLF to end of trailer headers (denoland/deno#3989) 2021-02-01 10:46:57 +00:00
木杉
fa41f87867 fix(file_server): don't crash on "%" pathname (denoland/deno#3953) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
82a523639a refactor: rewrite tests in to use Deno.test (denoland/deno#3930) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
da13beb681 feat: Support HTTP trailer headers for response (denoland/deno#3938) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
ce37fef3ea reenable server tests (denoland/deno#3928) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
7534d8390a remove non-null assertion operator from std (part2) (denoland/deno#3927) 2021-02-01 10:46:57 +00:00
Yusuke Sakurai
ee8ec4b053 remove non-null assertion operator from std (part1) (denoland/deno#3900) 2021-02-01 10:46:57 +00:00
Kitson Kelly
b839aca641 http/server::serve aligned to http/server::serveTLS (denoland/deno#3881) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
5dc3cf1090 chore: remove installer, port installer tests to Rust (denoland/deno#3843) 2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
7e3ced4885 feat: deno install in Rust (denoland/deno#3806)
//installer couldn't be removed due to bug, but it's now deprecated.
2021-02-01 10:46:57 +00:00
Bartek Iwańczuk
6b46758ef7 dx: descriptive permission errors (denoland/deno#3808)
Before:
```
▶ target/debug/deno https://deno.land/examples/echo_server.ts
error: Uncaught PermissionDenied: run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```

After:
```
▶ target/debug/deno https://deno.land/examples/echo_server.ts
error: Uncaught PermissionDenied: network access to "0.0.0.0:8080", run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: read access to "/etc/passwd", run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```
2021-02-01 10:46:56 +00:00
Carl Rosell
8f690cad2c fix(http): update listenAndServe argument type (denoland/deno#3775)
allow same argument type for `listenAndServe` as `serve`.
fixes: denoland/deno#3774
2021-02-01 10:46:56 +00:00
Takashi Idobe
085a04b6a1 change copyrights from 2019 to 2020 (denoland/deno#3733) 2021-02-01 10:46:56 +00:00
Bartek Iwańczuk
5a7013ec10 stabilize net Addr (denoland/deno#3709)
Co-authored-by: xiaoxintang <15707971810@163.com>
2021-02-01 10:46:56 +00:00
Bartek Iwańczuk
a939948e54 rename dial to connect and dialTLS to connectTLS (denoland/deno#3710) 2021-02-01 10:46:56 +00:00
Kevin (Kun) "Kassimo" Qian
bce291ef41 http: allow response body to be string (denoland/deno#3705) 2021-02-01 10:46:56 +00:00
Ry Dahl
06059e0f22 Revert "feat(flags): script arguments come after '--'" (denoland/deno#3681)
Due to complaints about ergonomics and because it breaks shebang on
linux.

This reverts commit 2d5457df15d8c4a81362bb2d185b5c6013faa1d8.

BREAKING CHANGE
2021-02-01 10:46:56 +00:00