forked from Mirrors/freeswitch
mod_http_cache: support amazon s3 region URLs
This commit is contained in:
parent
c46296f319
commit
77501db844
@ -44,7 +44,7 @@
|
||||
int aws_s3_is_s3_url(const char *url)
|
||||
{
|
||||
/* AWS bucket naming rules are complex... this match only supports virtual hosting of buckets */
|
||||
return !zstr(url) && switch_regex_match(url, "^https?://[a-z0-9_][-a-z0-9._]{1,61}[a-z0-9_]\\.s3\\.amazonaws\\.com/.*$") == SWITCH_STATUS_SUCCESS;
|
||||
return !zstr(url) && switch_regex_match(url, "^https?://\\w[\\w.]{1,61}\\w\\.s3([-\\w]+)?\\.amazonaws\\.com/.*$") == SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,9 @@ static void test_signature(void)
|
||||
*/
|
||||
static void test_check_url(void)
|
||||
{
|
||||
ASSERT_TRUE(aws_s3_is_s3_url("http://bucket.s3-us-west-1.amazonaws.com/object.ext"));
|
||||
ASSERT_TRUE(aws_s3_is_s3_url("https://bucket.s3-us-west-1.amazonaws.com/object.ext"));
|
||||
ASSERT_TRUE(aws_s3_is_s3_url("http://bucket.s3.amazonaws.com/object.ext"));
|
||||
ASSERT_TRUE(aws_s3_is_s3_url("http://bucket.s3.amazonaws.com/object.ext"));
|
||||
ASSERT_TRUE(aws_s3_is_s3_url("http://bucket.s3.amazonaws.com/object"));
|
||||
ASSERT_TRUE(aws_s3_is_s3_url("http://red.bucket.s3.amazonaws.com/object.ext"));
|
||||
|
Loading…
Reference in New Issue
Block a user