Skip to content
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

Comment branch #1

Closed
wants to merge 1 commit into from
Closed

Comment branch #1

wants to merge 1 commit into from

Conversation

anandkumarpatel
Copy link
Contributor

I am using this to put comments on specific lines of code.

* @param {function} cb Callback to execute once the server has started.
*/
function start(cb) {
server.serve(process.env.PORT, '127.0.0.1'); // NOTE: needs to be process.en
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'127.0.0.1' should be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required by the native-dns server implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooo, that sucks, then we should make it a process.env var if we put this guy in a container, that will not be the correct addr to listen too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted, and on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm are we not using latest native-dns? looks like they merged PR with this change in
tjfontaine/node-dns#88

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1b43031

@bkendall
Copy link
Contributor

@anandkumarpatel what is this PR? all it's doing it tabbing all the code in the file...

* @param {object} res Response object when the error occurred.
*/
function error(err, buff, req, res) {
error(err.stack);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to end the request req.end() on errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, reading up on how to indicate different types of errors in the DNS response (it's not as easy as putting in a status code, haha).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DNS uses a specialized format that is not compatible with HTTP. So I have to set specific bits in the response datagram so clients will handle it appropriately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, just read a up on it a bit, just logging might be good for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in coming PR

@anandkumarpatel
Copy link
Contributor Author

just a side note: I know @tjmehta has been promoting making everything more OOP with constructers and prototypes and what not and since we are writing this from scratch (like navi) might want to write it that way now (because it will never change later :P )

* @return {string} The remote ip address for the request.
*/
function getRequestIP(req) {
return req._socket._remote.address;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this info will be in the req.headers lets avoid using _* methods in other peoples modules (we hit issues with this before since people can make _* change as a patch and next time we npm install we will get that version)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So req in this context, while similar to express, is nothing like express. The request object here is is being created specifically from native-dns. From investigating the the request object this seemed to be the only way to get the requestor's ip address. I'll look into it more though, as I also dislike the underscore attributes.

@anandkumarpatel
Copy link
Contributor Author

@bkendall its so I can comment on the file.

@bkendall
Copy link
Contributor

huh.. okay...

@rsandor rsandor closed this Mar 31, 2015
@rsandor rsandor deleted the comments branch April 7, 2015 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants