Rename effective_options to effectiveOptions.
This commit is contained in:
parent
a21831a17e
commit
5dc00f43dc
2 changed files with 17 additions and 15 deletions
|
@ -39,7 +39,7 @@
|
||||||
var args, c, cb, k, length, v, _ref, _ref1, _ref2, _ref3, _ref4;
|
var args, c, cb, k, length, v, _ref, _ref1, _ref2, _ref3, _ref4;
|
||||||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
throw new Error('the cURL session is busy, use CurlBuilder.create to create another cURL Session');
|
throw new Error('the cURL session is busy, use curl.create to create another cURL Session');
|
||||||
}
|
}
|
||||||
if (!this.curl_) {
|
if (!this.curl_) {
|
||||||
throw new Error('the cURL is closed.');
|
throw new Error('the cURL is closed.');
|
||||||
|
@ -54,19 +54,21 @@
|
||||||
c.chunks = [];
|
c.chunks = [];
|
||||||
length = 0;
|
length = 0;
|
||||||
this.debug = (_ref1 = (_ref2 = this.defaultOptions.DEBUG) != null ? _ref2 : this.options.DEBUG) != null ? _ref1 : this.debug;
|
this.debug = (_ref1 = (_ref2 = this.defaultOptions.DEBUG) != null ? _ref2 : this.options.DEBUG) != null ? _ref1 : this.debug;
|
||||||
this.effective_options = {};
|
this.effectiveOptions = {};
|
||||||
_ref3 = this.defaultOptions;
|
_ref3 = this.defaultOptions;
|
||||||
for (k in _ref3) {
|
for (k in _ref3) {
|
||||||
v = _ref3[k];
|
v = _ref3[k];
|
||||||
this.effective_options[k] = v;
|
this.effectiveOptions[k] = v;
|
||||||
}
|
}
|
||||||
_ref4 = this.options;
|
_ref4 = this.options;
|
||||||
for (k in _ref4) {
|
for (k in _ref4) {
|
||||||
v = _ref4[k];
|
v = _ref4[k];
|
||||||
this.effective_options[k] = v;
|
this.effectiveOptions[k] = v;
|
||||||
}
|
}
|
||||||
this.setOptions(this.effective_options);
|
this.setOptions(this.effectiveOptions);
|
||||||
this.curl_.setopt('URL', this.url);
|
this.setOptions({
|
||||||
|
URL: this.url
|
||||||
|
});
|
||||||
c.on_write = function(chunk) {
|
c.on_write = function(chunk) {
|
||||||
curl.log("receive " + chunk.length + " bytes");
|
curl.log("receive " + chunk.length + " bytes");
|
||||||
c.chunks.push(chunk);
|
c.chunks.push(chunk);
|
||||||
|
@ -114,7 +116,7 @@
|
||||||
if (reset == null) {
|
if (reset == null) {
|
||||||
reset = true;
|
reset = true;
|
||||||
}
|
}
|
||||||
this.defaultOptions = options;
|
defaultOptions = options;
|
||||||
if (reset) {
|
if (reset) {
|
||||||
this.log('Set default options and reset cURL');
|
this.log('Set default options and reset cURL');
|
||||||
return this.reset();
|
return this.reset();
|
||||||
|
|
|
@ -18,7 +18,7 @@ class CurlBuilder
|
||||||
|
|
||||||
curl.perform = (args...) ->
|
curl.perform = (args...) ->
|
||||||
if @running
|
if @running
|
||||||
throw new Error 'the cURL session is busy, use CurlBuilder.create to create another cURL Session'
|
throw new Error 'the cURL session is busy, use curl.create to create another cURL Session'
|
||||||
|
|
||||||
if !@curl_
|
if !@curl_
|
||||||
throw new Error 'the cURL is closed.'
|
throw new Error 'the cURL is closed.'
|
||||||
|
@ -37,15 +37,15 @@ class CurlBuilder
|
||||||
@debug = @defaultOptions.DEBUG ? @options.DEBUG ? @debug
|
@debug = @defaultOptions.DEBUG ? @options.DEBUG ? @debug
|
||||||
|
|
||||||
|
|
||||||
@effective_options = {}
|
@effectiveOptions = {}
|
||||||
for k, v of @defaultOptions
|
for k, v of @defaultOptions
|
||||||
@effective_options[k] = v
|
@effectiveOptions[k] = v
|
||||||
|
|
||||||
for k, v of @options
|
for k, v of @options
|
||||||
@effective_options[k] = v
|
@effectiveOptions[k] = v
|
||||||
|
|
||||||
@setOptions @effective_options
|
@setOptions @effectiveOptions
|
||||||
|
@setOptions {URL: @url}
|
||||||
@curl_.setopt('URL', @url)
|
|
||||||
|
|
||||||
c.on_write = (chunk) ->
|
c.on_write = (chunk) ->
|
||||||
curl.log "receive #{chunk.length} bytes"
|
curl.log "receive #{chunk.length} bytes"
|
||||||
|
@ -84,7 +84,7 @@ class CurlBuilder
|
||||||
|
|
||||||
|
|
||||||
curl.setDefaultOptions = (options = {}, reset = true) ->
|
curl.setDefaultOptions = (options = {}, reset = true) ->
|
||||||
@defaultOptions = options
|
defaultOptions = options
|
||||||
if reset
|
if reset
|
||||||
@log 'Set default options and reset cURL'
|
@log 'Set default options and reset cURL'
|
||||||
@reset()
|
@reset()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue