[arvados] updated: 2.7.0-692-g0b6ccff62d
git repository hosting
git at public.arvados.org
Thu Oct 5 13:48:37 UTC 2023
Summary of changes:
lib/controller/rpc/conn_test.go | 7 +++---
.../initializers/clear_empty_content_type.rb | 26 ++++++++++++++++++++++
services/api/test/integration/http_quirks_test.rb | 16 +++++++++++++
3 files changed, 45 insertions(+), 4 deletions(-)
create mode 100644 services/api/config/initializers/clear_empty_content_type.rb
create mode 100644 services/api/test/integration/http_quirks_test.rb
via 0b6ccff62d345dcb196890a24e78a1681ead7638 (commit)
via f1b0b5b85b7479156aaaa55c0f2def6ffd7d3a40 (commit)
from e84fb97573407f2ddabdcfb3b905d201d0a300a5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 0b6ccff62d345dcb196890a24e78a1681ead7638
Author: Tom Clegg <tom at curii.com>
Date: Thu Oct 5 09:48:29 2023 -0400
20300: Fix crash on empty Content-Type header.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/services/api/config/initializers/clear_empty_content_type.rb b/services/api/config/initializers/clear_empty_content_type.rb
new file mode 100644
index 0000000000..3e501be212
--- /dev/null
+++ b/services/api/config/initializers/clear_empty_content_type.rb
@@ -0,0 +1,26 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Rails handler stack crashes if the request Content-Type header value
+# is "", which is sometimes the case in GET requests from
+# ruby-google-api-client (which have no body content anyway).
+#
+# This middleware deletes such headers, so a request with an empty
+# Content-Type value is equivalent to a missing Content-Type header.
+class ClearEmptyContentType
+ def initialize(app=nil, options=nil)
+ @app = app
+ end
+
+ def call(env)
+ if env["CONTENT_TYPE"] == ""
+ env.delete("CONTENT_TYPE")
+ end
+ @app.call(env) if @app.respond_to?(:call)
+ end
+end
+
+Server::Application.configure do
+ config.middleware.use ClearEmptyContentType
+end
diff --git a/services/api/test/integration/http_quirks_test.rb b/services/api/test/integration/http_quirks_test.rb
new file mode 100644
index 0000000000..107e6a6550
--- /dev/null
+++ b/services/api/test/integration/http_quirks_test.rb
@@ -0,0 +1,16 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'test_helper'
+
+class HttpQuirksTest < ActionDispatch::IntegrationTest
+ fixtures :all
+
+ test "GET request with empty Content-Type header" do
+ authorize_with :active
+ get "/arvados/v1/collections",
+ headers: auth(:active).merge("Content-Type" => "")
+ assert_response :success
+ end
+end
commit f1b0b5b85b7479156aaaa55c0f2def6ffd7d3a40
Author: Tom Clegg <tom at curii.com>
Date: Wed Oct 4 11:45:09 2023 -0400
20300: Update test.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/lib/controller/rpc/conn_test.go b/lib/controller/rpc/conn_test.go
index eee8db9ac8..452c6e1597 100644
--- a/lib/controller/rpc/conn_test.go
+++ b/lib/controller/rpc/conn_test.go
@@ -45,7 +45,7 @@ func (s *RPCSuite) SetUpTest(c *check.C) {
})
}
-func (s *RPCSuite) TestLogin(c *check.C) {
+func (s *RPCSuite) TestRailsLogin404(c *check.C) {
s.ctx = context.Background()
opts := arvados.LoginOptions{
ReturnTo: "https://foo.example.com/bar",
@@ -54,14 +54,13 @@ func (s *RPCSuite) TestLogin(c *check.C) {
c.Check(err.(*arvados.TransactionError).StatusCode, check.Equals, 404)
}
-func (s *RPCSuite) TestLogout(c *check.C) {
+func (s *RPCSuite) TestRailsLogout404(c *check.C) {
s.ctx = context.Background()
opts := arvados.LogoutOptions{
ReturnTo: "https://foo.example.com/bar",
}
resp, err := s.conn.Logout(s.ctx, opts)
- c.Check(err, check.IsNil)
- c.Check(resp.RedirectLocation, check.Equals, opts.ReturnTo)
+ c.Check(err.(*arvados.TransactionError).StatusCode, check.Equals, 404)
}
func (s *RPCSuite) TestCollectionCreate(c *check.C) {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list