Skip to content

Commit

Permalink
use agent option
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Jan 18, 2013
1 parent f857814 commit 3cb9efa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/cookiejar.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ CookieJar.prototype.matchCookie = function(cookie, url){

CookieJar.prototype.setCookie = function(cookie_str, url){
var parts = (cookie_str || "").split(";"),
cookie = {}, upath,
urlparts = urllib.parse(url || "", false, true);
cookie = {},
urlparts = urllib.parse(url || "", false, true),
path;

parts.forEach((function(part){
var key, val;
Expand Down
8 changes: 6 additions & 2 deletions lib/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ exports.fetchUrl = fetchUrl;
function FetchStream(url, options){
Stream.call(this);

options = options || {};

this.url = url;
if(!this.url){
return this.emit("error", new Error("url not defined"));
Expand Down Expand Up @@ -140,6 +142,10 @@ FetchStream.prototype.parseUrl = function(url){
method: this.options.method
};

if("agent" in this.options){
urloptions.agent = this.options.agent;
}

switch(urlparts.protocol){
case "https:":
transport = https;
Expand Down Expand Up @@ -397,8 +403,6 @@ function fetchUrl(url, options, callback){
});

fetchstream.on("end", function(error){
var convert;

buffer = new Buffer(length);
for(var i=0, len = chunks.length; i<len; i++){
chunks[i].copy(buffer, curpos);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fetch",
"description": "Fetch URL contents",
"version": "0.3.0",
"version": "0.3.1",
"author": "Andris Reinman",
"maintainers": [
"andris <[email protected]>"
Expand Down

0 comments on commit 3cb9efa

Please sign in to comment.