1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-24 15:12:55 +08:00

409 Commits

Author SHA1 Message Date
107409cee8 Added ability to specify true/false for bool opts
License: MIT
Signed-off-by: ForrestWeston <Forrest.Weston@gmail.com>
2015-10-13 17:11:05 -07:00
8f0623255d replace imports with absolute path instead of using symlink
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-10-03 14:30:50 -07:00
9634b25b63 remove hard-coded json content-type for streaming http output
There was a stale assumption that streaming output from a channel would
always be json.
This commit removes that code, allowing Content-Type to appropriately be
set like other, non-channel-streaming commands.

License: MIT
Signed-off-by: Cayman Nava <caymannava@gmail.com>
2015-09-24 19:13:29 -07:00
e5a2896c0e extract logging
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-09-14 17:35:50 -07:00
408bea3797 Merge pull request #1641 from rht/namedpipe
Serialfile: Explicit err on unrecognized file type
2015-09-05 03:19:54 +02:00
206739d10c allow channel marshaler to return errors from cmds.Response
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-09-04 14:12:19 -07:00
rht
ccc9cd6a6c Refactor serialfile
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-09-04 16:57:44 +07:00
rht
ddc8dff736 serialfile: Explicit err on unrecognized file type
So that ipfs add on daemon no longer blocks

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-09-04 16:57:44 +07:00
018e20ae19 Merge pull request #1628 from rht/size-walk
Use filepath.Walk to compute serialfile total size
2015-09-03 16:32:02 +02:00
rht
00a56a14ec serialfile: localize os.Open into NewSerialFile
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-09-03 20:30:41 +07:00
006cd5fe25 Merge pull request #1627 from ipfs/feat/symlinks
implement symlinks in unixfs, first draft
2015-09-02 22:36:50 +02:00
d85d61c968 recover and print panics that happen in API server
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-09-02 11:12:13 -07:00
167532c2b6 fix direct symlink adding
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-09-02 10:51:03 -07:00
4bcacc5936 address most of CR comments
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-09-02 10:12:04 -07:00
rht
b45e82418b Use filepath.Walk to compute serialfile total size
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-08-31 10:57:54 +07:00
d993bc04d6 implement symlinks in unixfs, first draft
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-08-30 13:33:42 -07:00
rht
d32177cda0 Make sure ctx in commands are derived from req.Context
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-08-23 19:35:03 +07:00
978c9fa16f cmds/add: use dagutils.Editor, like patch
This changes the pin behavior. It uses the filenames given through
the api, and allows files to be streamed faltly (not a hierarchy),
which is easier for other things (like vinyl in node-ipfs-api land).
Files can also be entirely out of order, and the garbage intermediate
directories will not be pinned (gc-ed later).

The changes also mean the output of add has changed slightly-- it
no longer shows the local path added, but rather the dag path
relative to the added roots. This is a small difference, but changes
tests.

The dagutils.Editor creates a lot of chaff (intermediate objects)
along the way. Wonder how we might minimize the writes to the
datastore...

This commit also removes the "NilRepo()" part of the --only-hash
mode. We need to store at least in an in-mem repo/datastore because
otherwise the dagutils.Editor breaks.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-12 08:24:06 +02:00
3ee83a7c5e fix cors: defaults should take the port of the listener
need to do it this way to avoid VERY confusing situations where
the user would change the API port (to another port, or maybe even
to :0). this way things dont break on the user, and by default,
users only need to change the API address and things should still
"just work"

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-02 08:16:51 +02:00
8a75c755d4 Merge pull request #1539 from ipfs/log-api-route
fix log tail command
2015-07-29 15:22:49 -07:00
082c147bbe should fix issue where 'read on closed body' error was leaking down
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-29 13:26:39 -07:00
b10e26a429 cancel contexts when client disconnects
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-29 11:02:10 -07:00
4a7c1cf802 add -w improvement: wrap multiple files in one dir
> ipfs add a b c
  added Qmbvkmk9LFsGneteXk3G7YLqtLVME566ho6ibaQZZVHaC9 a
  added QmR9pC5uCF3UExca8RSrCVL8eKv7nHMpATzbEQkAHpXmVM b
  added QmetGxZTgo8tYAKQH1KLsY13MxqeVHbxYVmvzBzJAKU6Z7 c
  added QmXg3WHLcjnz4ejeYF6FKVBkb4m1oKjQmF5fEWL9M1uQF3

  > ipfs ls QmXg3WHLcjnz4ejeYF6FKVBkb4m1oKjQmF5fEWL9M1uQF3
  Qmbvkmk9LFsGneteXk3G7YLqtLVME566ho6ibaQZZVHaC9 10 a
  QmR9pC5uCF3UExca8RSrCVL8eKv7nHMpATzbEQkAHpXmVM 10 b
  QmetGxZTgo8tYAKQH1KLsY13MxqeVHbxYVmvzBzJAKU6Z7 10 c

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-29 03:07:39 -07:00
8f35c3bcd9 more serious CORS tests.
this commit introduces more serious CORS tests that check
status response codes, and run real HTTP requests.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 23:08:11 -07:00
d5f94be474 fix API handler to respect referer + exit on CORS
this commit makes the API handler short circuit the request if the
CORS headers say its not allowed. (the CORS handler only sets the
headers, but does not short-circuit)

It also makes the handler respect the referer again. See security
discussion at https://github.com/ipfs/go-ipfs/issues/1532

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 23:08:11 -07:00
5d9ee59908 address CR comment re interface in cmds http handler
https://github.com/ipfs/go-ipfs/pull/1529#discussion_r35662230

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 23:08: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
c633e2b575 cmds/http: remove referrer check
it used to be here for a CSRF check. but we now have CORS checks.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 23:08:09 -07:00
7cf5e87cfe Added API + Gateway support for arbitrary HTTP headers
This commit fixes + improves CORS support

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 23:08:09 -07:00
681da0aa21 Merge pull request #1531 from ipfs/fix/stream-header
only set stream header on streamed output
2015-07-28 12:59:54 -07:00
98559d0e0b put comment back 2015-07-28 08:44:35 -07:00
c175700dea Better error message on unrecognized command
Closes issue #1436

License: MIT
Signed-off-by: Shaun Bruce <shaun.m.bruce@gmail.com>
2015-07-28 09:20:53 -06:00
2cad99d5ef only set stream header on streamed output
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-28 08:18:31 -07:00
8176766d5a naming and cleanup
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-27 17:25:38 -07:00
0c4b10afb2 comment need for custom client
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-27 15:19:43 -07:00
23d41e0823 address comments from CR and fix random failures
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-27 09:30:52 -07:00
1ce310be8b some commenting
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-26 11:28:53 -07:00
fd75b64630 refactor http client code
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-25 19:56:45 -07:00
2b06ffaa7d better refactor of http handler code
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-25 18:46:44 -07:00
a7e50f1fbc implement http trailers for errors after headers are sent
refactor http handler and copyChunks to get this all to work correctly
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-25 11:07:31 -07:00
814f437fb4 cmds/http/handler: set stream error trailer
stream output might break. in these cases we need to notify the
client. this is after a 200 response has been sent. We do this
by setting a special trailer (header after the body):

  X-Stream-Error: <error cause>

This is similar to what's done by systems like gRPC. This still
needs to be read + handled on the other side.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-24 14:49:34 -07:00
886d47561a http/client: log errors when stream copy fails
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-24 14:41:57 -07:00
8286abaf8c attempt at properly closing http response bodies
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-22 13:31:33 -07:00
5873aa2aaa if no context set in request, use context.TODO()
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-20 21:46:51 -07:00
bb3a75aa08 remove context from context
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-20 20:53:06 -07:00
f9f3c6a527 make offline commands respect timeout
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-20 14:34:16 -07:00
6083007987 add a global timeout flag for to be setting timeouts
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-20 12:53:37 -07:00
e55a130b49 Add hidden file support to add
License: MIT
Signed-off-by: Gaetan Voyer-Perrault <gatesvp@gmail.com>
2015-07-09 04:07:34 -07:00
663f37cb99 core/commands/unixfs/ls: Don't recurse into chunked files
Folks operating at the Unix-filesystem level shouldn't care about that
level of Merkle-DAG detail.  Before this commit we had:

  $ ipfs unixfs ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox:
  ... several lines of empty-string names ...

And with this commit we have:

  $ ipfs unixfs ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox

I also reworked the argument-prefixing (object.Argument) in the output
marshaller to avoid redundancies like:

  $ ipfs unixfs ls /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox:
  /ipfs/QmSRCHG21Sbqm3EJG9aEBo4vS7Fqu86pAjqf99MyCdNxZ4/busybox

As a side-effect of this rework, we no longer have the trailing blank
line that we used to have after the final directory listing.

The new ErrImplementation is like Python's NotImplementedError, and is
mostly a way to guard against external changes that would need
associated updates in this code.  For example, once we see something
that's neither a file nor a directory, we'll have to update the switch
statement to handle those objects.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-13 13:06:34 -07:00
rht
3547f7ae33 Replace 'var * bytes.Buffer' with '\1 := new(bytes.Buffer)' 2015-05-26 23:18:04 +07:00