 URL = Npm.require('url')
 http = Npm.require('http')
 https = Npm.require('https')
+zlib = Npm.require('zlib')
 querystring = Npm.require('querystring')
+
+gunzipSync = Meteor.wrapAsync zlib.gunzip.bind(zlib)
+inflateSync = Meteor.wrapAsync zlib.inflate.bind(zlib)
 
 OEmbed = {}
 

		if response.statusCode isnt 200
			return callback null, {parsedUrl: parsedUrl}

		str = ''
		response.on 'data', (chunk) ->
			str += chunk
			if str.length > 250000
				request.abort()

		response.on 'end', ->
			callback null, {
				headers: response.headers
				body: str
				parsedUrl: parsedUrl
			}


		hostname: urlObj.hostname
		path: urlObj.path
		rejectUnauthorized: !RocketChat.settings.get 'Allow_Invalid_SelfSigned_Certs'
		headers:
			'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36'

	httpOrHttps = if urlObj.protocol is 'https:' then https else http

