1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00

86 Commits

Author SHA1 Message Date
53d47669da bubble up go-datastore deps
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-11-28 22:29:38 -08:00
ce96b915e7 gateway: change status code of failed namesys resution to 500
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-11-16 05:37:38 +01:00
43320e1b7f gateway: use switch for error handling
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-11-16 05:29:39 +01:00
82d46a5b5b gateway: degrade error in gateway to log to reduce noise
It logs all errors including expired IPNS keys and other non important
errors.

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-11-16 05:25:18 +01:00
396c629301 update to newer ipld node interface with Copy and better Tree
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-11-15 18:00:49 -08:00
0097b422de gateway: use core api for serving POST requests
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-11-07 18:25:49 +01:00
c31e4f7226 gateway: move context/close-notify wiring
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-11-07 18:25:49 +01:00
029f971d9c gateway: use core api for serving GET/HEAD requests
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-11-07 18:25:49 +01:00
9843e86258 Changed so only explicit ipfs cli commands are lowercased
License: MIT
Signed-off-by: Richard Littauer <richard.littauer@gmail.com>
2016-10-27 22:55:13 -07:00
67c2a4ec14 make path resolver no longer require whole node for construction
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-10-25 15:04:44 -07:00
eac13abaec update to new cid and ipld node packages
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-10-25 09:54:04 -07:00
ded60a7356 unixfs: allow use of raw merkledag nodes for unixfs files
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-10-17 16:51:39 -07:00
01aee44679 merkledag: change 'Node' to be an interface
Also change existing 'Node' type to 'ProtoNode' and use that most
everywhere for now. As we move forward with the integration we will try
and use the Node interface in more places that we're currently using
ProtoNode.

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-10-12 08:16:03 -07:00
f4d7369c4a bitswap: protocol extension to handle cids
This change adds the /ipfs/bitswap/1.1.0 protocol. The new protocol
adds a 'payload' field to the protobuf message and deprecates the
existing 'blocks' field. The 'payload' field is an array of pairs of cid
prefixes and block data. The cid prefixes are used to ensure the correct
codecs and hash functions are used to handle the block on the receiving
end.

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-10-10 08:19:31 -07:00
1f9ec4e3ed update to libp2p 4.0.1 and propogate other changes
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-10-05 22:12:43 -07:00
e43c770530 update libp2p and dht packages
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-09-25 23:42:14 -07:00
2e6e0f18e3 routing: use extracted dht and routing code
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-09-19 18:28:00 -07:00
c8fe495934 integrate CIDv0
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-09-07 13:32:32 -07:00
bf23516dc0 cache encoded data when reading dag nodes from disk
License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
2016-07-10 13:13:35 -07:00
1afebc21f3 gateway: clean up its surface, and remove BlockList
This patch is in preparation for the gateway's extraction.

It's interesting to trace technical debt back to its
origin, understanding the circumstances in which it
was introduced and built up, and then cutting it back
at exactly the right places.

- Clean up the gateway's surface
  The option builder GatewayOption() now takes only
  arguments which are relevant for HTTP handler muxing,
  i.e. the paths where the gateway should be mounted.
  All other configuration happens through the
  GatewayConfig object.

- Remove BlockList
  I know why this was introduced in the first place,
  but it never ended up fulfilling that purpose.
  Somehow it was only ever used by the API server,
  not the gateway, which really doesn't make sense.
  It was also never wired up with CLI nor fs-repo.
  Eventually @krl started punching holes into it
  to make the Web UI accessible.

- Remove --unrestricted-api
  This was holes being punched into BlockList too,
  for accessing /ipfs and /ipn on the API server.
  With BlockList removed and /ipfs and /ipns freely
  accessible, putting this option out of action
  is safe. With the next major release,
  the option can be removed for good.

License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-06-19 00:52:35 +02:00
6d4975d82c Move go-humanize to gx
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-06-09 11:32:02 +02:00
a77fa94fdf Make errors more reasonable in case of node in offline mode
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2016-05-24 15:59:56 +02:00
c2a3e3169d Set Cache-Control immutable
Given that /ipfs/ resources never change, we can easily benefit from this
new cache control extension.

Support for this is about to land in Firefox 49:

https://bugzilla.mozilla.org/show_bug.cgi?id=1267474

For more details, there is a good blogpost about this here:

https://bitsup.blogspot.de/2016/05/cache-control-immutable.html

This header is ignored by clients that don't support it.

License: MIT
Signed-off-by: kpcyrd <git@rxv.cc>
2016-05-12 12:16:42 +02:00
09937f84b6 gateway: enforce allowlist for path prefixes
The gateway accepts an X-Ipfs-Path-Prefix header,
and assumes that it is mounted in a reverse proxy
like nginx, at this path. Links in directory listings,
as well as trailing-slash redirects need to be rewritten
with that prefix in mind.

We don't want a potential attacker to be able to
pass in arbitrary path prefixes, which would end up
in redirects and directory listings, which is why
every prefix has to be explicitly allowed in the config.

Previously, we'd accept *any* X-Ipfs-Path-Prefix header.

Example:

We mount blog.ipfs.io (a dnslink page) at ipfs.io/blog.

nginx_ipfs.conf:

    location /blog/ {
        rewrite "^/blog(/.*)$" $1 break;
        proxy_set_header Host blog.ipfs.io;
        proxy_set_header X-Ipfs-Gateway-Prefix /blog;
        proxy_pass http://127.0.0.1:8080;
    }

.ipfs/config:

    "Gateway": {
        "PathPrefixes": ["/blog"],
        // ...
    },

dnslink:

    > dig TXT _dnslink.blog.ipfs.io
    dnslink=/ipfs/QmWcBjXPAEdhXDATV4ghUpkAonNBbiyFx1VmmHcQe9HEGd

License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2016-04-04 16:31:57 -04:00
b3c9922c7b merkledag: Remove unused AddRecursive and RemoveRecursive
License: MIT
Signed-off-by: Mildred Ki'Lya <mildred-pub.git@mildred.fr>
2016-03-04 07:48:34 +01:00
5367ee76d0 fix another panic where CloseNotify was called from wrong goroutine
panic: net/http: CloseNotify called after ServeHTTP finished

    goroutine 180 [running]:
    net/http.(*response).CloseNotify(0xc8220684e0, 0x0)
        /home/r/go/src/net/http/server.go:1535 +0x9d
    github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prometheus/client_golang/
        /home/r/src/github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/prome
    github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).getOrHeadHandler.func1(0x7
        /home/r/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:119 +
    created by github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).getOrHeadHandle
        /home/r/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:123 +

License: MIT
Signed-off-by: Robert Carlsen <rwcarlsen@gmail.com>
2016-02-09 11:09:43 -06:00
0e312f5caf initial vendoring of libp2p outside of the repo with gx
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-30 09:34:06 -08:00
8651143344 Gateway: add support for HTTP OPTIONS request type
OPTIONS is a noop request that is used by the browsers
to check if server will accept cross-site XMLHttpRequest
(indicated by the presence of CORS headers)

Before this fix user could enable CORS headers in the Gateway config,
but XHR failed due to the lack of support for OPTIONS request type
(as described in https://git.io/vzgGe)

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
2016-01-21 23:22:54 +01:00
a83c3a334f use ServeContent for index.html
One advantage is that it sets the Content-Type header correctly.

License: MIT
Signed-off-by: Etienne Laurin <etienne@atnnn.com>
2016-01-12 08:22:55 -08:00
rht
743f3edcbb strings.Split -> path.SplitList
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2016-01-12 08:22:55 -08:00
rht
ffd859232d Replace strings.Join(elms, "/") with path.Join(elms)
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2016-01-12 08:22:55 -08:00
bf955f3560 add closenotify and large timeout to gateway
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-12 08:22:55 -08:00
efac042e82 rework editor creation and finalization
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-12 08:22:55 -08:00
b12ee40aba implement mark and sweep GC
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

dont GC blocks used by pinner

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

comment GC algo

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

add lock to blockstore to prevent GC from eating wanted blocks

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

improve FetchGraph

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

separate interfaces for blockstore and GCBlockstore

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

reintroduce indirect pinning, add enumerateChildren dag method

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-12 08:21:13 -08:00
c9ce2e724a Simplify Pinner interface by folding ManualPinner into Pinner
Pinner had method GetManual that returned a ManualPinner, so every
Pinner had to implement ManualPinner anyway.

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-01-12 08:17:17 -08:00
8ad1141436 fixup panic catching in http handler funcs
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-12-28 04:18:56 -08:00
a6eb32b77c Fix path parsing for add command
License: MIT
Signed-off-by: Dominic Della Valle <ddvpublic@gmail.com>
2015-12-22 10:59:17 -05:00
bdc1b27c51 hard code things
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-11-30 14:43:37 -08:00
021ef43418 gateway: add path prefix for directory listings
License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2015-11-16 07:00:57 +01:00
c1847e9f69 putHandler: addressed CR from @jbenet
License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-10-31 01:37:37 +01:00
b8b4e45665 fixing putHandler for --writable http gateway
I disabled this a long time ago and never refactored it. About time.

License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-10-28 08:11:56 +01:00
rht
4b3a21eceb Humanize bytes in dir index listing
Fixes https://github.com/ipfs/dir-index-html/issues/3

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-08-29 09:58:21 +07:00
rht
de5c0ceff0 Localize the scope of context.WithCancel for every DAG.Get
Instead put it inside of DAG.Get.
The fix is applied only in the case when the context.WithCancel
before a DAG.Get is also used later on in the scope.

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-08-23 22:38:04 +07:00
09d7501724 gateway: make IPNSHostname complete
IPNSHostnameOption() touches the URL path only on the way in,
but not on the way out. This commit makes it complete by
touching the following URLs in responses:

- Heading, file links, back links in directory listings
- Redirecting /foo to /foo/ if there's an index.html link
- Omit Suborigin header

License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
2015-08-17 15:39:19 +02:00
39a23392c1 use rabin fingerprinting for a chunker
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

implement rabin fingerprinting as a chunker for ipfs

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

vendor correctly

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

refactor chunking interface a little

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

work chunking interface changes up into importer

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

move chunker type parsing into its own file in chunk

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-08-08 15:33:10 -07:00
4a571b099b implement arbitrary HTTP header support
this commit adds the ability to specify arbitrary HTTP headers
for either the Gateway or the API. simply set the desired headers
on the config:

    ipfs config --json API.HTTPHeaders.X-MyHdr '["meow :)"]'
    ipfs config --json Gateway.HTTPHeaders.X-MyHdr '["meow :)"]'

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 23:08:10 -07:00
053e531dac http/index: fix indention and remove unused field
License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-07-04 00:51:42 +02:00
0ed49dbbfb http/gateway:
- First tab at integrating @krl's new index page

File icons are embedded in side icons.css (QmXB7PLRWH6bCiwrGh2MrBBjNkLv3mY3JdYXCikYZSwLED contains both the icons and bootstrap)

- Fix back links (..)  (fixes #1365)

Thanks @JasonWoof for the insight.  The back links now stop a t the root hash and work for links that do and dont end with a slash.

License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-07-04 00:51:42 +02:00
ef294431d4 move util.Key into its own package under blocks 2015-06-01 16:10:08 -07:00
dd928a2b1d change pinning to happen in a callback 2015-05-28 08:52:20 -07:00