I also found that Apache didn’t care what the Host header was when using HTTP/1.1, just so long as something was there: However I did find that I could ignore the Host header if I specified HTTP/1.0: I could not get it to work with an absoluteURI, even using the example in the RFC. Recipients of an HTTP/1.0 request that lacks a Host header field MAY attempt to use heuristics (e.g., examination of the URI path for something unique to a particular host) in order to determine what exact resource is being requested. If the host as determined by rule 1 or 2 is not a valid host on the server, the response MUST be a 400 (Bad Request) error message. If the Request-URI is not an absoluteURI, and the request includes a Host header field, the host is determined by the Host header field value.ģ. Any Host header field value in the request MUST be ignored.Ģ. If Request-URI is an absoluteURI, the host is part of the Request-URI.
I looked up the HTTP specification, and as described in section 5.2 of the RFC:ġ. I swear I’ve done this before without a Host header though. I eliminated the User-Agent the Accept headers and it still worked, so the missing Host header was the cause of my problems. I put the same headers (with a modified User-Agent) into my printf statement: I decided to take a look at what curl was sending, since that was working: Which also returned a HTTP/1.1 400 Bad Request error. Which returned a HTTP/1.1 400 Bad Request error. On a server running Apache 2.4.6, first I tried: curl is an excellent tool for ad hoc HTTP requests.
I put it here though as it is a query about how to use a particular linux command.Įdited by rp88, 04 January 2020 - 11:10 PM.I must have had some reason for wanting to do this, although I can’t think of why right now. Moderators: if you think this would be betetr in the networking forum please move it.
I have searched on google but haven't been able to work out the right cobination of keywords to bring up results of relevance to me.
I want to keep using netcat and roughly this sort of method, not some completely different tool, because of compatibility reasons about what software is on the devices. I'm using a high port number which shouldn't conflict with any of the reserved addresses of 1024 and below. Besides I don't generally need to communicate to ALL devices, just several at once? The devices can all be assumed to be running linux. I don't want to make too many asumptions about the routing hardware invoved in whatevr wird or wifi network is in use, so don't want to try to use braodcast capacities in a router (apparently if you send data to certain local IP addresses on certain routers they send it on to all devices on the LAN) or anything like that. I am working with IPv4, IPv6 is not under consideration here, I suspect some of the devices don't support it anyway. n ch dùng a ch IP dng s, chng hn nh 192.168.16.7, Netcat s không thm vn DNS -o file ghi nht kí vào file -p port ch nh cng port -r yêu cu Netcat chn cng ngu nhiên(random) -s addr gi mo a ch. Is there a convenient way to send this to many IP addresses at once, for example all in the range 192.168.1.25 through to 192.168.1.49, or all of those addresses with a last number divisible by 10, or all of them over 210 (so all from 211 up to 255). Nó s lng nghe tr li sau mi khi ngt mt kt ni. I've been using netcat with the syntax described below to send message between systems on a local network.Įcho -n 'message here' | netcat -w 1 IPtoSendTo PortToSendTo