What headers are automatically sent by wget?

HttpHttp HeadersWget

Http Problem Overview


I know that you can manually set some headers with the --header option, but I want to know what headers it sends without interaction.

Http Solutions


Solution 1 - Http

Using the -d (--debug) option I see it set:

---request begin---
GET / HTTP/1.0
User-Agent: Wget/1.12 (cygwin)
Accept: */*
Host: www.uml.edu
Connection: Keep-Alive

---request end---

Solution 2 - Http

that's easy to check: write a script that displays the sent headers or dump headers with your web server.

with PHP you need print_r(getallheaders());

Array
(
    [User-Agent] => Wget/1.11.4
    [Accept] => */*
    [Host] => localhost
    [Connection] => Keep-Alive
)

Tested with GNU Wget 1.11.4.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBryan AgeeView Question on Stackoverflow
Solution 1 - HttpribramView Answer on Stackoverflow
Solution 2 - HttpKaroly HorvathView Answer on Stackoverflow