Skip to content

api: Always strip 80/443 port from host#709

Merged
harshavardhana merged 1 commit into
minio:masterfrom
vadmeste:issues/695
Jun 16, 2017
Merged

api: Always strip 80/443 port from host#709
harshavardhana merged 1 commit into
minio:masterfrom
vadmeste:issues/695

Conversation

@vadmeste
Copy link
Copy Markdown
Member

HTTP clients like browsers or curl automatically strip port 80 and 443
in Host header. This PR makes minio-go follow the same behavior
so the generated presigned urls can work without having signature
mismatch error.

Fixes #695

harshavardhana
harshavardhana previously approved these changes Jun 14, 2017
Copy link
Copy Markdown
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must need. Thanks @vadmeste

@harshavardhana harshavardhana requested review from krishnasrinivas and krisis and removed request for krishnasrinivas June 15, 2017 02:26
Copy link
Copy Markdown
Member

@krisis krisis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Does it make sense to write a unit test for makeTargetURL?

@harshavardhana
Copy link
Copy Markdown
Member

LGTM. Does it make sense to write a unit test for makeTargetURL?

👍

@vadmeste
Copy link
Copy Markdown
Member Author

LGTM. Does it make sense to write a unit test for makeTargetURL?

Tests for makeTargetURL are added.

Comment thread api_unit_test.go
{"localhost:9000", false, "mybucket", "myobject", "", nil, url.URL{Host: "localhost:9000", Scheme: "http", Path: "/mybucket/myobject"}, nil},
// Test 7
{"localhost:9000", false, "mybucket", "myobject", "", map[string][]string{"param": []string{"val"}}, url.URL{Host: "localhost:9000", Scheme: "http", Path: "/mybucket/myobject", RawQuery: "param=val"}, nil},
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case each with address https://localhost:443 and http://localhost:80?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case each with address https://localhost:443 and http://localhost:80?

oups, yes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case each with address https://localhost:443 and http://localhost:80?

Done @krisis

HTTP clients like browsers or curl automatically strip port 80 and 443
in Host header. This PR makes minio-go follow the same behavior
so the generated presigned urls can work without having signature
mismatch error.
Copy link
Copy Markdown
Member

@krisis krisis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants