 
 	return deferred.promise
 
+
+obtainCharset = (headers) ->
+        contentType = headers['content-type'] || ''
+        matches =  contentType.match(/charset=([^;,\r\n]+)/i)
+        if (matches && matches[1]) 
+                return matches[1]
+        return  'utf-8'
+
+
 sendHttpRequest = (ctx, responseDst, options, secured, callback) ->
 	method = http
 
 	if secured
-		method = https
+                method = https
 
 	routeReq = method.request options, (routeRes) ->
 		responseDst.status = routeRes.statusCode

		routeRes.on "data", (chunk) ->
                        bufs.push chunk

		routeRes.on "end", ->
                        responseDst.timestamp = new Date()
                        responseDst.body = Buffer.concat(bufs)
			callback()

	routeReq.on "error", (err) ->

util = require('util');
zlib = require('zlib');
http = require 'http'
https = require 'https'
net = require 'net'
