Comments (8)
Hey Boris,
I think we had this but at some point it was removed. Are you sure the Host header can or should include the port as part of its value? AFAIK the port is only used for establishing the connection to that specific port on a server, and has nothing to do with the Host itself.
from needle.
Hi Tomas!
Thanks for the response
I think it should be in some cases, am no expert in this field but dug up some spec from w3
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
"A "host" without any trailing port information implies the default port for the service requested (e.g., "80" for an HTTP URL)"
Unfortunately this slight edge case is an issue am bumping into
from needle.
Would you mind sharing the code that's giving you trouble, so I can reproduce the bug?
from needle.
Sorry for the long delay. Please excuse the rather noobish code below (with a funky infinite loop). Have tested it in the context on my app, but it should still work externally. The first time, from a browser, will show the headers.host as ''localhost:8081". The second time around from needle will show just "localhost".
express().all("", function (req, res) {
console.log("Host is... " + req.headers.host);
var url = "http://localhost:8081" ;
needle.get(url, {}, function() {});
}
express().listen(8081)
Hopefully this should be enough to get the gist, but I think the port will be missing in whatever way the original needle command is made
from needle.
Hey Boris, sorry for the delay mate. What do you mean by first and second time? Because of a redirect?
from needle.
Sorry, the needle request will loop back into the same code. So the first time the context is a standard call to node, the second time will be the needle get request. First time the host contains the port, the second time from needle the host does not contain the port
from needle.
Ok sir, just tested and fixed it. Pushing 0.6.1 as we speak... Thanks again for reporting!
from needle.
Hey no problem! Mucho thanks for taking the time to chat and fix it :)
from needle.
Related Issues (20)
- Incorrect parsing of complex JS nested objects in POST request HOT 5
- Mangled file content when multipart-POSTing a file with a "text/*" content type HOT 2
- Very infrequent TypeError: iconv.encodingExists is not a function
- Tunnelling doesn't work in v3.1.0 HOT 12
- Proposal: Supporting User-Defined "Follow If" Conditions
- Piping needle request to Express response won't set the correct headers
- Multiple Files Upload Renames Input Field
- Uncaught asynchronous error
- Remote end closed socket abruptly errors HOT 2
- a ':' in nonce breaks digest authentication HOT 1
- Digest MD5 not working with Geovision IP Camera
- Uncaught ECONNRESET exception
- needle.get cannot guaranty getting the http stream HOT 2
- FEATURE: Retry HOT 1
- follow_set_cookies -> not working!!!
- Bug in 3.3.0: accidental creation of `global.signal`, gets caught in strict UTs
- README recommends mikeal's request HOT 3
- Multipart uploads strips date values in the request body HOT 2
- Doesn't work in Cloudflare Workers HOT 1
- Sorry, I was about to post this issue to a different repo, don't even know how it happened that I posted it here
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from needle.