|
@ -120,7 +120,6 @@ static size_t current_buffer_len; |
|
|
|
|
|
|
|
|
#define HTTP_CB(name) \ |
|
|
#define HTTP_CB(name) \ |
|
|
static int name(http_parser* p_) { \ |
|
|
static int name(http_parser* p_) { \ |
|
|
HandleScope scope; \ |
|
|
|
|
|
Parser* self = container_of(p_, Parser, parser_); \ |
|
|
Parser* self = container_of(p_, Parser, parser_); \ |
|
|
return self->name##_(); \ |
|
|
return self->name##_(); \ |
|
|
} \ |
|
|
} \ |
|
@ -129,7 +128,6 @@ static size_t current_buffer_len; |
|
|
|
|
|
|
|
|
#define HTTP_DATA_CB(name) \ |
|
|
#define HTTP_DATA_CB(name) \ |
|
|
static int name(http_parser* p_, const char* at, size_t length) { \ |
|
|
static int name(http_parser* p_, const char* at, size_t length) { \ |
|
|
HandleScope scope; \ |
|
|
|
|
|
Parser* self = container_of(p_, Parser, parser_); \ |
|
|
Parser* self = container_of(p_, Parser, parser_); \ |
|
|
return self->name##_(at, length); \ |
|
|
return self->name##_(at, length); \ |
|
|
} \ |
|
|
} \ |
|
@ -214,12 +212,10 @@ struct StringPtr { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Handle<String> ToString() const { |
|
|
Handle<String> ToString() const { |
|
|
HandleScope scope; |
|
|
if (str_) |
|
|
if (str_) { |
|
|
return String::New(str_, size_); |
|
|
return scope.Close(String::New(str_, size_)); |
|
|
else |
|
|
} else { |
|
|
return String::Empty(); |
|
|
return scope.Close(String::Empty()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -517,8 +513,6 @@ public: |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
Local<Array> CreateHeaders() { |
|
|
Local<Array> CreateHeaders() { |
|
|
HandleScope scope; |
|
|
|
|
|
|
|
|
|
|
|
// num_values_ is either -1 or the entry # of the last header
|
|
|
// num_values_ is either -1 or the entry # of the last header
|
|
|
// so num_values_ == 0 means there's a single header
|
|
|
// so num_values_ == 0 means there's a single header
|
|
|
Local<Array> headers = Array::New(2 * (num_values_ + 1)); |
|
|
Local<Array> headers = Array::New(2 * (num_values_ + 1)); |
|
@ -528,7 +522,7 @@ private: |
|
|
headers->Set(2 * i + 1, values_[i].ToString()); |
|
|
headers->Set(2 * i + 1, values_[i].ToString()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return scope.Close(headers); |
|
|
return headers; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|