mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-13 07:45:26 +00:00
mod_http_cache: fixed validation of S3 URL
This commit is contained in:
parent
adcf3fb26b
commit
259337ca57
@ -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?://\\w[\\w.]{1,61}\\w\\.s3([-\\w]+)?\\.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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,6 +107,10 @@ static void test_parse_url(void)
|
||||
aws_s3_parse_url(strdup("http://bucket.s3.amazonaws.com/voicemails/recording.wav"), &bucket, &object);
|
||||
ASSERT_STRING_EQUALS("bucket", bucket);
|
||||
ASSERT_STRING_EQUALS("voicemails/recording.wav", object);
|
||||
|
||||
aws_s3_parse_url(strdup("https://my-bucket-with-dash.s3-us-west-2.amazonaws.com/greeting/file/1002/Lumino.mp3"), &bucket, &object);
|
||||
ASSERT_STRING_EQUALS("my-bucket-with-dash", bucket);
|
||||
ASSERT_STRING_EQUALS("greeting/file/1002/Lumino.mp3", object);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user