Debian Codegraph @

awklib/eg/network/geturl.awk

raw
1 BEGIN {
2 if (ARGC != 2) {
3 print "GETURL - retrieve Web page via HTTP 1.0"
4 print "IN:\n the URL as a command-line parameter"
5 print "PARAM(S):\n -v Proxy=MyProxy"
6 print "OUT:\n the page content on stdout"
7 print " the page header on stderr"
8 print "JK 16.05.1997"
9 print "ADR 13.08.2000"
10 exit
11 }
12 URL = ARGV[1]; ARGV[1] = ""
13 if (Proxy == "") Proxy = "127.0.0.1"
14 if (ProxyPort == 0) ProxyPort = 80
15 if (Method == "") Method = "GET"
16 HttpService = "/inet/tcp/0/" Proxy "/" ProxyPort
17 ORS = RS = "\r\n\r\n"
18 print Method " " URL " HTTP/1.0" |& HttpService
19 HttpService |& getline Header
20 print Header > "/dev/stderr"
21 while ((HttpService |& getline) > 0)
22 printf "%s", $0
23 close(HttpService)
24 }