1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-21 00:47:22 +08:00

260 Commits

Author SHA1 Message Date
c94bd768d2 fix(gw): links in CID column on dir listing
This switches go-ipfs to dir-index-html after
https://github.com/ipfs/dir-index-html/pull/43
got merged to master
2020-09-28 23:12:47 +02:00
cd1feb3af4 fix(gateway): correct breadcrumbs on dnslink site 2020-09-25 23:11:53 +02:00
044790a838 feat: Directory page UI improvements
These changes are needed to prepare for the Directory page UI improvements
implemented in https://github.com/ipfs/dir-index-html/issues/37.

- update dir-index-html type structs
- emit gateway URL for root links
- emit CID of each directoryItem
- emit size of directory
- emit breadcrumbs
2020-08-19 20:09:35 -04:00
2d5f8b4ebe Include the git blob id of the dir-index bundle in the ETag
While the content of raw files retrieved via the gateway should never
change, the look and feel of the directory index can and will change
between versions of go-ipfs.

Incorporate the hash of assets/bindata.go into the ETag when appropriate
2020-05-25 18:42:07 +00:00
6a2fe0a20d fix: support directory listings even if a 404 page is present
fixes https://github.com/ipfs/go-ipfs/pull/4233#issuecomment-631454543

Basically, there's a trade-off here:

1. We can support directory listings while supporting 404 pages (this PR).
2. If a 404 page is present, directory listings don't work.

Given that option 1 is more flexible and users shouldn't be _too_ confused if
they land on a directory with no index.html page, I've gone with that option.
2020-05-20 19:11:50 -07:00
d4952f2a73 fix(gateway): ensure directory listings have Content-Type text/html
Files already have an explicit Content-Type set. Be sure to do this for
directory listings as well to avoid a fallback to autodetection in
net/http. That fallback fails when a ResponseWriter is installed that
performs compression.
2020-05-20 15:20:33 +02:00
7c7888c4db fix(gateway): fix status code for HEAD on redirects
Report a consistent status code for HEAD requests that end up in a
redirect.
2020-05-20 14:03:58 +02:00
dfceafdbd3 Gateway renders pretty 404 pages if available
In the same way that an `index.html` file is rendered, if one is present, when the
requested path is a directory, now an `ipfs-404.html` file is rendered if
the requested file is not present within the specified IPFS object.

`ipfs-404.html` files are looked for in the directory of the requested path and each
parent until one is found, falling back on the well-known 404 error message.

License: MIT
Signed-off-by: JP Hastings-Spital <jphastings@gmail.com>
2020-05-19 14:41:21 -07:00
e93f2002f5 optimize import order 2020-05-02 14:19:01 +05:30
214d29ebf8 #7252 - print error message 2020-05-01 22:37:20 +05:30
9201b1dde6 #7252 - read content directly instead of sending 512bytes 2020-05-01 20:29:32 +05:30
2e87ac88a3 Fixes #7252 - Uses gabriel-vasile/mimetype to support additional content types 2020-05-01 12:19:36 +05:30
46ae021733 feat: show the absolute path every time
Even for dnslink websites.

fixes https://github.com/ipfs/go-ipfs/issues/7205
2020-04-26 17:19:17 -07:00
d8bc5c991e feat: always show the hash
Previously, we only showed this /ipns paths. However, knowing the hash of the
current directory is useful regardless.
2020-04-26 16:09:02 -07:00
1e437c7e97 Fix typos and cleanup 2020-04-20 22:00:01 +03:00
8290ec11c3 fix: subdomain redirect for dir CIDs
Closes #7164

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2020-04-15 23:50:53 +02:00
7340543615 corehttp: Gateway handler: add Allow headers when returning MethodNotAllowed
Spec says that response with 405 must set Allow headers.
2020-04-05 09:57:57 +02:00
f9567a0a0f fix(gateway): curl without redirect on localhost
When request is sent to http://localhost:8080/ipfs/$cid response has
HTTP 301 status code and "Location" header with redirect destination at
$cid.ipfs.localhost:8080

Redirect is followed by browsersi, but not by commandline tools.
Status 301 is ignored by curl in default mode: it will print response
and won't follow redirect, user needs to add -L for that.

To fix curl, we return correct payload in body of HTTP 301 response,
but set Clear-Site-Data header to ensure Origin sandbox can't be abused.

This requires a surgical workaround:
If Location header is present in ResponseWriter's Header map,
we ensure http.ServeContent() returns HTTP 301

Context: https://github.com/ipfs/go-ipfs/pull/6982

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2020-03-18 08:50:40 -07:00
3ecccd6e1d feat(gateway): subdomain and proxy gateway
License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2020-03-18 08:50:38 -07:00
72490f7ed0 gateway: simplify/improve dnslink rewrite handling
Instead of adding a new fake header (that could be spoofed by the client...),
just read the original request URI from the request object.

This also removes support for suborigins. They have never been implemented in
browsers and it looks like efforts have stalled. We can add support back if we
need it but, well, maintaining support was going to be more trouble than it was
worth.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2020-03-17 19:34:44 -07:00
a53d48059b fix: migrate from deprecated warning function 2020-01-28 21:20:21 -08:00
725e6844ee gateway: cleanup logic
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2020-01-10 10:19:13 +01:00
5eea0a4ba0 http: use Method* constants
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2020-01-10 10:19:08 +01:00
453b78962b chore(gateway): remove dead code 2020-01-05 16:43:45 -08:00
1a06fb6e2f fix(gateway): correct symlink content type
We should be _resolving_ symlinks (sometimes, still need to figure out when to
do this WRT IPNS). However, that's a larger feature.
2020-01-05 16:43:44 -08:00
3859f08bf7 fix(gateway): better seeking/sized
1. Require files to have known sizes. We can add support for unknown sizes
_later_ but we can't use ServeContent for those files.
2. Replace the `sizeReadSeeker` with a `lazySeeker`. This one makes no
assumptions about how it's used so we're less likely to run into weird bugs.
2020-01-05 16:43:44 -08:00
e8a6c0c050 fix(gateway): gracefully handle files with unknown sizes in directory listings 2020-01-05 16:43:44 -08:00
62451039ec fix(gateway): serve the index with serveFile 2020-01-05 16:43:44 -08:00
115b2ba6cd fix: limit SW registration to content root
Introduces hardening proposed in:
https://github.com/ipfs/go-ipfs/issues/4025#issuecomment-342250616

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2019-12-17 02:20:40 +01:00
7ae6f6fa3e chore(gateway): document encoding fix 2019-11-06 11:47:27 +00:00
69f6e08d9d chore(gateway): remove redundant seek 2019-11-06 11:45:41 +00:00
a12d2e265e chore(gateway): fix error call 2019-11-06 11:44:56 +00:00
ebf2e7da36 chore(gateway): fix import ordering 2019-11-06 11:44:32 +00:00
a29a9dbb98 gateway: ServeFile: use file extension to determine Content-Type
License: MIT
Signed-off-by: Abdeldjalil Hebal <dreamski21@gmail.com>
2019-11-06 01:52:49 +01:00
69f81a11dd Update gateway_handler.go 2019-11-05 17:36:26 +01:00
aefff48654 fix #2203: omit the charset attribute when Content-Type is text/html
License: MIT
Signed-off-by: Abdeldjalil Hebal <dreamski21@gmail.com>
2019-11-02 21:56:54 +01:00
521a29956b fix and improve the writable gateway
1. Fix handling of PUT. The simple implementation was the correct
   implementation, I have no idea what was going on here.
2. Use MFS everywhere to reduce code duplication and add support for sharded
   directories.
3. _Correctly_ block IPNS.
4. Remove the dependency on `core.IpfsNode`.
5. Remove support for putting empty directories with a well-known CID. It was
   useless as directories are automatically created.
2019-07-25 19:22:56 -07:00
d460150f43 gateway: label get requests latency with the path namespace 2019-06-04 17:47:08 -07:00
846b6b5d95 add unixfs get metric
License: MIT
Signed-off-by: whyrusleeping <why@ipfs.io>
2019-06-04 17:36:42 -07:00
e8c2852179 migrate to go-libp2p-core.
closes #6391

License: MIT
Signed-off-by: Raúl Kripalani <raul@protocol.ai>
2019-05-31 23:23:52 -07:00
23d35184c3 fix: use http.Error for sending errors
This sets a few headers that prevent browsers from misinterpreting the error
text.
2019-05-25 10:45:17 -07:00
tg
d2836de577 core/corehttp/gateway_handler: pass a request ctx instead of the node ctx
License: MIT
Signed-off-by: Georgij Tolstov <tolstov.georgij@gmail.com>
2019-04-23 13:43:32 +03:00
7046626ecc Move pathresolve
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-04-17 16:56:27 -07:00
a54b64bede coreiface: updates for path name refactor
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-04-17 12:03:37 -07:00
667b7f9927 coreiface: updates for moving path to subpackage
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-04-17 12:03:37 -07:00
2e77df04ca coreapi: Update path error handling
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
2019-04-17 12:03:37 -07:00
42e191c017 gx: unrewrite
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2019-03-05 18:33:56 +01:00
3dac4609a8 split 'mode' into IsOnline and IsDaemon flags
1. They don't _have_ to be mutually exclusive.
2. local, mode, etc is _really_ confusing.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-03-04 19:00:47 -08:00
f227862e88 gx: update go-ipfs-cmds, go-bitswap, go-libp2p-kad-dht, and go-mplex
Fixes the latest batch of bugs found in RC testing.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2019-02-27 12:39:24 -08:00
6972a9aa4d Gx Bubble. libp2p-6.0.38
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-02-27 01:10:59 +00:00