Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/consts/src/regexs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ export const APIFY_PROXY_VALUE_REGEX = /^[\w._~]+$/;
/**
* Regular expression to validate proxy urls, matches
* http://asd:[email protected]:8000
* http://asd:[email protected]:8000/
* http://123123:qweqwe:[email protected]:55555
* http://proxy.apify.com:5000
* http://[email protected]:5000
*/
export const PROXY_URL_REGEX = /^https?:\/\/(([^:]+:)?[^@]*@)?[^.:@]+\.[^:]+:[\d]+?$/;
export const PROXY_URL_REGEX = /^(socks(4|4a|5|5h)?|https?):\/\/(([^:]+:)?[^@]*@)?[^.:@]+\.[^:]+:[\d]+?$/;

/**
* AWS S3 docs say:
Expand Down
2 changes: 1 addition & 1 deletion packages/input_schema/src/intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const intlStrings = {
'inputSchema.validation.proxyGroupsNotAvailable':
'You currently do not have access to proxy groups: {groups}',
'inputSchema.validation.customProxyInvalid':
'Proxy URL "{invalidUrl}" has invalid format, it must be http[s]://[username[:password]]@hostname:port.',
'Proxy URL "{invalidUrl}" has invalid format, it must be socks[4|4a|5|5h]|http[s]://[username[:password]]@hostname:port.',
'inputSchema.validation.apifyProxyCountryInvalid':
'Country code "{invalidCountry}" is invalid. Only ISO 3166-1 alpha-2 country codes are supported.',
'inputSchema.validation.apifyProxyCountryWithoutApifyProxyForbidden':
Expand Down
24 changes: 24 additions & 0 deletions test/regexs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,30 @@ const tests = {
'https://www.linkedin.com/company/companyname/extra/extra/',
],
},
PROXY_URL_REGEX: {
valid: [
'http://asd:[email protected]:8000',
'http://asd:[email protected]:8000',
'http://123123:qweqwe:[email protected]:55555',
'http://proxy.apify.com:5000',
'http://[email protected]:5000',
'https://proxy.apify.com:5000',
'socks://proxy.apify.com:5000',
'socks4://proxy.apify.com:5000',
'socks4a://proxy.apify.com:5000',
'socks5://proxy.apify.com:5000',
'socks5h://proxy.apify.com:5000',
],
invalid: [
'http://@proxy.apify.com:8000/',
'https://proxy.apify.com',
'httpss://proxy.apify.com:5000',
'htt://proxy.apify.com:5000',
'soks://proxy.apify.com:5000',
'socks3://proxy.apify.com:5000',
'socks6://proxy.apify.com:5000',
],
},
};

describe('regexps', () => {
Expand Down
Loading