... Accept Specifies media formats that the client can accept Accept-Charset Tells the server the types of character sets that the client can handle Accept-Encoding Specifies the encoding schemes ... SCHEME REALM Accept: image/gif Accept: image/x-xbitmap Accept: image/jpeg Authorization: BASIC d2VibWFzdGVyOnpycW1hNHY= The server checks the authorization, and upon successful authentication, ... dynamic documents (e.g., created on the fly by a CGI script). Under HTTP 1. 0, the Pragma header was used with the value no-cache to tell caching proxies and clients not to cache the document....
... telnet to connect to port 13 : (intense) /homes/apm> telnet localhost 13 Trying 12 7.0.0 .1 Connected to localhost. Escape character is '^'. Tue Jun 14 00:03 :12 19 96 Connection closed ... end the connection. Figure 4 -1 shows the flow of a sockets transaction. Figure 4 -1. Socket calls Using the Socket Calls Accepting a Connection The accept( ) function waits for an incoming ... connection associated with that socket on a specified remote host and port. The server uses the accept( ) call to intercept the incoming connection and initiate communication with the client....
... #!/bin/ksh echo "PUT /~apm/hi.txt HTTP /1. 0 User-Agent: shcat /1. 0 Accept: */* Content-type: text/plain Content-length: 2 hi" | shcat http://publish.ora.com/ Grep out URL References When ... "User-Agent: hcat /1. 0\n\n"; Replace it with this: # copy STDIN to network connection while (<STDIN>) {print F;} and save it as shcat. Now you can say whatever you want on shcat's ... HTML, may cause your current client to interpret important values incorrectly. Changes in data may be unpredictable. When your client doesn't understand the data, it is safer for the client...
... URLs, such as escaping or expanding. Chapter 5: The LWP Library- P1 As we showed in Chapter 1, the Web works over TCP/IP, in which the client and server establish a connection and then exchange ... $ua->proxy( (@scheme | $scheme), $proxy_url) Defines a URL to use with the specified schemes. The first parameter can be an array of scheme names or a scalar that defines a single scheme. The second ... functions to classify response codes into the categories of informational, successful, redirection, error, client error, or server error. It also exports symbolic aliases of HTTP response codes;...
... invoked without a second parameter, uri_escape( ) escapes characters specified by RFC 17 38. Otherwise, one can pass in a regular expression (in the context of [ ]) of characters to escape as ... method, like GET or HEAD. 3. Which is January 1, 19 70, UTC on UNIX systems. 4. Since HTML syntax trees use circular references, the Perl garbage collector does not currently dispose of the memory ... HTTP response code with HTTP::Response->is_success( ) by calling the is_success( ) method from the $response object. If the request was successful, we use HTTP::Response::content( ) by invoking...
... 010 0.gif at 1 a.m., 0200.gif at 2 a.m, etc. A periodic client might check some data and perform action when a condition is met. In this section, we present a program that periodically checks ... $opt _c )) { print_help( ); exit(0); } # my $tracker = new FedEx $cgi, $opt_e, $opt_ p; my $keep_checking = 1; First, we declare local variables, call all necessary modules, get command-line ... FedEx package, let's take a look at the complete example. Note how one creates a FedEx object and calls it. We'll come back to this example and redo it as a graphical client in Chapter...
... we keep track of which documents don't exist, what their content types are, which ones are local to the web server, which are not local, and which are not HTTP-based. After scan( ) finishes, ... associate any URL that has been visited with a value of 1. There are other useful variables that are also used, to track which document points to what, the content-type of the document, which ... information is available from CheckSite's public interface. The bad( ) method returns an associative array of any URLs that encountered errors. Within the associative array, one uses the...
... in order. Now we can use another function called traverse(), which operates on this data structure and lets us specify what function to call for each piece of information it contains. Keeping ... in Chapter 5, The LWP Library, the HTML package contains a function called parse_html(), which takes a string containing HTML as its argument, and returns a pointer to a data structure with ... run it, it would look like Figure 7 -1. Chapter 7: Graphical Examples with Perl/Tk- P1 The Tk extension to Perl can be used to create a Graphical User Interface (GUI) to your Perl programs on...
... "CHINA", "COLOMBIA", "CONGO", "COOK ISLANDS", "COSTA RICA", "COTE D'IVOIRE", "CROATIA", "CYPRUS", "CZECH ... REPUBLIC", "DENMARK", Chapter 7: Graphical Examples with Perl/Tk- P2 The do_search( ) function will take an optional $url argument, to give it an alternative place to connect ... If we succeed, then we want to get the actual document out and parse it. $html will contain the HTML tree object. We reconfigure the text object to "normal" so that we can place text...
... Package tracking client Chapter 7: Graphical Examples with Perl/Tk- P3 Our destinations list is an almost exact copy of the list you'd see on the web page. For ease in using, we placed ... 'top_left_arrow'); -yscrollcommand => ['set', $scroll], -exportselection => 0); $scroll->configure(-command => ['yview', $listbox]); $scroll->pack(-side => ... The rest of the code is repeated from Chapter 6: ## Package FedEx Written by Clinton Wong package FedEx; use HTTP::Request; use HTTP::Response; elsif ($response->content =~ /Delivery...
... selected. my $site = ""; my ($content, @down); my @selected = $list->curselection; $mw->configure(-cursor => 'watch'); $mw->idletasks; foreach $index ... actually ping each site. The code to check a site's status is as follows, where $site is a string containing a standard URL (like http://www.ora.com): $content = head($site); if ($content) ... $history_label->configure(-background => $old_color); } } The function ping_site( ) is called when a new site is added to update its status. It is also called when in automode. It checks the...
... then responds with: HTTP /1. 0 2 01 Created Date: Fri, 04 Oct 19 96 14 : 31: 51 GMT Server: HypotheticalPublish /1. 0 Content-type: text/html Content-length: 30 <h1>The file was created.</h2> ... hypothetical.ora.com Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* The server responds with: HTTP /1. 0 200 OK Date: Fri, 04 Oct 19 96 14 :33:43 GMT Server: Apache /1. 1 .1 Content-type: ... the CGI program. The CGI program then returns some data, and the server passes it back to the client as follows: HTTP /1. 0 200 OK Date: Tue, 01 Oct 19 96 14 :52:06 GMT Server: Apache /1. 1 .1 Content-type:...