

Hostname can be a numerical IP address or a symbolic hostname (unless the -n option is given). ** = These options are not available in all versions of Netcat, check your local man pages. z Just scan for listening daemons, without sending any data to them. Protocol is used (1080 for SOCKS, 3128 for HTTPS). If port is not specified, the well-known port for the proxy Is not specified, SOCKS version 5 is used.Ĭonnect to hostname using a proxy at proxy_address and port. '5' (SOCKS v.5) and 'connect' (HTTPS proxy). Requests that nc should use the specified protocol when talking The -w flag has noĮffect on the -l option, i.e. If a connection and stdin are idle for more than timeout seconds, u Use UDP instead of the default option of TCP. Valid values are the tokens 'lowdelay', 'throughput', 'reliability', orĪn 8-bit hexadecimal value preceded by '0x'. T ToS Specifies IP Type of Service (ToS) for the connection. This makes it possible to use nc to script telnet sessions. t Send RFC 854 DON'T and WON'T responses to RFC 854 DO and WILL requests. S Enables the RFC 2385 TCP MD5 signature option. It is an error to use this option in conjunction with the -l option. The IP of the interface which is used to send the packets. Sequentially within a range or in the order that the system assigns them. r Select the source and/or destination ports randomly instead of Specify the source port nc should use, subject to privilege n Skip all DNS or service lookups on addresses, hostnames or ports. Peer is not reachable and generating an adpative timeout Number of probes to send to the peer before declaring that the It is an error to use this option in conjunctionĪdditionally, any timeouts specified with the -w option are ignored.

l Listen for an incoming connection rather than initiate a connection k Force nc to stay listening for another connection after its currentĬonnection is completed. Number of times to repeat TCP keep alive packets. Interval for repeating TCP keep alive timeouts in seconds. Initial TCP keep alive timeout in seconds. Specifies a delay time interval between lines of text sent and received.Īlso causes a delay time between connections to multiple ports. This will prevent any text being sent from a client to the server. C Force nc not to use cellular data context. I did not specify a ServerName in my Apache config, but even after I specified ServerName 127.0.0.1:80 in /etc/httpd/conf/nf and restarted Apache, it still required the Host header and it still didn’t care what the content of the Host header was (so long as it was not empty).Read and write data across networks - arbitrary TCP and UDP connections and listens. 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 must have had some reason for wanting to do this, although I can’t think of why right now.
