-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use TLS module in HTTPS #1560
Use TLS module in HTTPS #1560
Conversation
d4634da
to
c0c8a9c
Compare
Quite good patch |
c0c8a9c
to
408d3ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good shape. Only a few comments.
var ClientRequest = require('http_client').ClientRequest; | ||
var HTTPParser = require('httpparser'); | ||
var HTTPServer = require('http_server'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"http underscore server" and "httpparser" sounds inconsistent. Although this is legacy so you can keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It bothers me too. :) I didn't want to change it in this PR, because it is quite unrelated.
src/js/http_client.js
Outdated
OutgoingMessage.call(this); | ||
|
||
// get port, host and method. | ||
var port = options.port = options.port || 80; | ||
var host = options.host = options.hostname || options.host || '127.0.0.1'; | ||
options.host = options.hostname || options.host || '127.0.0.1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this after the var declarations.
test/profiles/host-darwin.profile
Outdated
@@ -1,2 +1,4 @@ | |||
ENABLE_MODULE_IOTJS_BASIC_MODULES | |||
ENABLE_MODULE_IOTJS_CORE_MODULES | |||
ENABLE_MODULE_HTTPS | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra newline?
@@ -181,7 +183,7 @@ finalReq.end(); | |||
var server2 = http.createServer(); | |||
|
|||
// Create server instance without new keyword. | |||
var server3 = Server(function(request, response) {}); | |||
// var server3 = Server(function(request, response) {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to uncomment it, but it works. I'll fix it.
key: fs.readFileSync('resources/my_key.pem').toString(), | ||
cert: fs.readFileSync('resources/my_crt.pem').toString() | ||
}; | ||
try { throw 1; } catch(e) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, it is a leftover. I'll will fix it.
408d3ad
to
dc437ad
Compare
Just a few notes about this PR:
|
What about creating another key? |
@zherczeg unfortunately it does not work. I tried with both |
@LaszloLango @zherczeg It seems better to include HTTPS tests. We are fine with 2-(b), disabling asan in mbedtls, for now. However, 2-(c) is also needed. Once it's fixed, let's re-enable 2-(b). Could you open an issue for 2-(c) so that we can track it? |
dc437ad
to
34d9322
Compare
docs/api/IoT.js-API-HTTPS.md
Outdated
| https.get | X | X | X | X | O | | ||
| | Linux<br/>(Ubuntu) | Raspbian<br/>(Raspberry Pi) | NuttX<br/>(STM32F4-Discovery) | TizenRT<br/>(Artik053) | | ||
| :---: | :---: | :---: | :---: | :---: | | ||
| http.createServer | O | O | △ ¹ | △ ¹ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https
@daeyeon I've reported the issue: Mbed-TLS/mbedtls#1550 Since #1341 landed we can test the HTTPS module without enabling it on default build. We can add it to |
@LaszloLango It's right not to include HTTPS on the default build. Please add it to |
34d9322
to
f2f822b
Compare
@daeyeon I've updated the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with one minor request.
src/modules.json
Outdated
"https_native": { | ||
"native_files": ["modules/iotjs_module_https.c"], | ||
"init": "InitHttps" | ||
"require": ["https_client", "httpparser", "http_server", "net", "tls"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The https_client
is deleted. Why do we need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, it is a typo. It should be "http_client"
I'll fix it.
* Removed the curl dependency * Updated the mbedtls configuration * Removed the code duplications of HTTP and HTTPS modules * Updated the related test files IoT.js-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
f2f822b
to
fb5f2c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. A bit different from what we prefer though. We can fix it later.
* Removed the curl dependency * Updated the mbedtls configuration * Removed the code duplications of HTTP and HTTPS modules * Updated the related test files IoT.js-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
IoT.js-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com