Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Not handling correctly request.url when inject an invalid URL #28

Closed
hugoerortiz opened this issue Aug 10, 2020 · 4 comments · Fixed by #29
Closed

Not handling correctly request.url when inject an invalid URL #28

hugoerortiz opened this issue Aug 10, 2020 · 4 comments · Fixed by #29

Comments

@hugoerortiz
Copy link
Contributor

We recently had a problem with pino in hapi, because hapi is unable to create the request.url object when the URL is invalid, see this gist

@jsumners
Copy link
Member

Please state what the problem is.

@hugoerortiz
Copy link
Contributor Author

the node process crash when you send or inject an invalid URL, and I expect and 404

@jsumners
Copy link
Member

Is there an error message? What is it?

@hugoerortiz
Copy link
Contributor Author

hugoerortiz commented Aug 10, 2020

yep, here are the log traces

TypeError [ERR_INVALID_URL]: Invalid URL: http://:80/(a%7Cb).loclhost:80a/
    at onParseError (internal/url.js:257:9)
    at new URL (internal/url.js:333:5)
    at Request._parseUrl (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:180:25)
    at Request.get url [as url] (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:114:21)
    at Object.reqSerializer [as req] (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/pino-std-serializers/lib/req.js:66:20)
    at asChindings (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/pino/lib/tools.js:173:50)
    at Pino.child (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/pino/lib/proto.js:120:28)
    at /Users/huortiz/dev/plat/consumer-apps-ol/node_modules/hapi-pino/index.js:93:29
    at exports.Manager.execute (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/toolkit.js:57:29)
    at Request._invoke (/Users/huortiz/dev/plat/consumer-apps-ol/node_modules/@hapi/hapi/lib/request.js:391:55) {

I am doing PR to propose to use request.path instead of request.url.path to avoid this error

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants