@cryptotaxi247 / kubo / commits / bdc1b27c5

hard code things

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

Jeromy committed Nov 30, 2015 at 14:43 UTC bdc1b27c51ff3dc7b465c8c5c0a98b97ae6454dc
3 files changed +10 -18
commands/http/handler.go
+5
@@ -255,6 +255,11 @@ func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req
255 h.Set(contentTypeHeader, mime)
256 h.Set(transferEncodingHeader, "chunked")
257
258 + // set 'allowed' headers
259 + h.Set("Access-Control-Allow-Headers", "X-Stream-Output, X-Chunked-Output")
260 + // expose those headers
261 + h.Set("Access-Control-Expose-Headers", "X-Stream-Output, X-Chunked-Output")
262 +
263 if r.Method == "HEAD" { // after all the headers.
264 return
265 }
core/corehttp/gateway_handler.go
+5
@@ -134,6 +134,11 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
134 i.addUserHeaders(w) // ok, _now_ write user's headers.
135 w.Header().Set("X-IPFS-Path", urlPath)
136
137 + // set 'allowed' headers
138 + w.Header().Set("Access-Control-Allow-Headers", "X-Stream-Output, X-Chunked-Output")
139 + // expose those headers
140 + w.Header().Set("Access-Control-Expose-Headers", "X-Stream-Output, X-Chunked-Output")
141 +
142 // Suborigin header, sandboxes apps from each other in the browser (even
143 // though they are served from the same gateway domain).
144 //
repo/config/init.go
-18
@@ -44,16 +44,6 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
44 API: "/ip4/127.0.0.1/tcp/5001",
45 Gateway: "/ip4/127.0.0.1/tcp/8080",
46 },
47 - API: API{
48 - HTTPHeaders: map[string][]string{
49 - "Access-Control-Allow-Headers": []string{
50 - "X-Stream-Output, X-Chunked-Output",
51 - },
52 - "Access-Control-Expose-Headers": []string{
53 - "X-Stream-Output, X-Chunked-Output",
54 - },
55 - },
56 - },
47
48 Bootstrap: BootstrapPeerStrings(bootstrapPeers),
49 SupernodeRouting: *snr,
@@ -81,14 +71,6 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
71 Gateway: Gateway{
72 RootRedirect: "",
73 Writable: false,
84 - HTTPHeaders: map[string][]string{
85 - "Access-Control-Allow-Headers": []string{
86 - "X-Stream-Output, X-Chunked-Output",
87 - },
88 - "Access-Control-Expose-Headers": []string{
89 - "X-Stream-Output, X-Chunked-Output",
90 - },
91 - },
74 },
75 }
76