1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-11 23:46:39 +08:00

63 Commits

Author SHA1 Message Date
2f5563b3c0 fix log hanging issue, and implement close-notify for commands
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-11-05 15:57:28 -08:00
94bdce63a7 vendor logging lib update
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-11-05 15:57:21 -08:00
bb9493ac7c content type on command responses default to text
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-10-29 02:11:09 -07:00
c023d187b5 update code to use new logging changes
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-10-27 11:04:56 -07:00
4470826fe2 fix streaming output to flush per write
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-10-21 14:51:03 -07:00
27eece3e81 Merge pull request #1835 from miolini/master
fix races in http cors
2015-10-20 12:47:06 -07:00
4555085844 fix races in http cors
License: MIT
Signed-off-by: Artem Andreenko <mio@volmy.com>
2015-10-13 01:09:55 +03:00
e89f7b8ded use go's built in handling of trailers and dont do custom chunking
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

use go1.5 syntax to ensure builds on older versions fail

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

fix t0230

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-10-11 23:04:41 -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
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
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
b10e26a429 cancel contexts when client disconnects
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-29 11:02:10 -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
98559d0e0b put comment back 2015-07-28 08:44:35 -07: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
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
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
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
496e7a4b2c Vendor CORS library. 2015-05-10 10:58:37 -07:00
f6c6d5de13 Add CORS middleware handler to the API. 2015-05-08 18:41:00 -07:00
f640ba0089 core: add context.Context param to core.Resolve()
commands/object: remove objectData() and objectLinks() helpers
resolver: added context parameters
sharness: $HASH carried the \r from the http protocol with
sharness: write curl output to individual files
http gw: break PUT handler until PR#1191
2015-05-08 03:14:32 +02:00
bf22aeec0a Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs
- Modified Godeps/Godeps.json by hand
- [TEST] Updated welcome docs hash to sharness
- [TEST] Updated contact doc
- [TEST] disabled breaking test (t0080-repo refs local)
2015-03-31 12:52:25 -07:00
92d08db7a5 rewrote import paths of go.net/context to use golang.org/x/context
- updated go-ctxgroup and goprocess
ctxgroup: AddChildGroup was changed to AddChild. Used in two files:
- p2p/net/mock/mock_net.go
- routing/dht/dht.go

- updated context from hg repo to git
prev. commit in hg was ad01a6fcc8a19d3a4478c836895ffe883bd2ceab. (context: make parentCancelCtx iterative)
represents commit 84f8955a887232b6308d79c68b8db44f64df455c in git repo

- updated context to master (b6fdb7d8a4ccefede406f8fe0f017fb58265054c)

Aaron Jacobs (2):
net/context: Don't accept a context in the DoSomethingSlow example.
context: Be clear that users must cancel the result of WithCancel.

Andrew Gerrand (1):
go.net: use golang.org/x/... import paths

Bryan C. Mills (1):
net/context: Don't leak goroutines in Done example.

Damien Neil (1):
context: fix removal of cancelled timer contexts from parent

David Symonds (2):
context: Fix WithValue example code.
net: add import comments.

Sameer Ajmani (1):
context: fix TestAllocs to account for ints in interfaces
2015-02-25 11:58:19 +01:00
e8bbf1dcdf commands/http: Made command HTTP API only accept requests from referers on the same server 2015-02-04 18:46:59 -08:00
58f39687cf logs: removed all log.Errors unhelpful to users
Let's save log.Error for things the user can take action on.
Moved all our diagnostics to log.Debug. We can ideally reduce them
even further.
2015-02-03 01:06:07 -08:00
6adebfad11 commands: Added Length field to Response
squash! commands: Added Length field to Response

commands/http: client: Fixed error on unset length
2015-01-23 18:29:29 -08:00
31ae178078 commands: Support outputting <-chan interface{} 2015-01-21 04:28:02 +00:00
322d6d0b05 cmds: use flushCopy instrad of copychunks
@mappum would this work?
2015-01-11 20:52:33 -08:00
ddd7540186 cmds: flush output on standard readers
cc @mappum can we do this for the copyChunks case?
2015-01-11 20:52:33 -08:00
0e2a554c8d cmds: fix error header output
using Header().Set after WriteHeader() has no effect.
cc @mappum
2015-01-11 20:52:33 -08:00
981f793df9 commands: Use a flag to enable streaming channel output 2015-01-06 15:53:48 -08:00
71838adf49 commands/http: handler: Fixed chunk copier to be able to write response before request is done 2015-01-06 15:53:48 -08:00
c3c0b248e8 commands/http: Made Handler stream channel output 2015-01-06 15:53:48 -08:00
aaab7d0898 commands/http: Allow API requests from whitelisted origins 2014-11-25 06:12:35 -08:00
4b9fa9c97c commands/http: Use constants for header names 2014-11-18 02:13:53 -08:00
c46102cec5 fix(commands/http/handler) check if found
@mappum, could you CR this and let me know if I've interpreted the
desired behavior correctly?
2014-11-14 03:19:57 -08:00