Send an HTTP OPTIONS request

Google Translate started sending my website "OPTIONS" requests recently. I wanted to check what response it made, so I made the following based on the Stack Overflow post mentioned.

#!/home/ben/software/install/bin/perl
use warnings;
use strict;
use HTTP::Request;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new ();
my $request = HTTP::Request->new (OPTIONS => 'http://kanji.sljfaq.org/hw-17.cgi');
my $response = $ua->request ($request);
print $response->as_string (), "\n";

(download)

As of October 2016, my site returns something like this:

HTTP/1.1 200 OK
Connection: close
Date: Mon, 10 Oct 2016 00:20:34 GMT
Via: 1.1 vhost.phx2.nearlyfreespeech.net:3128 (squid/2.7.STABLE7)
Server: Apache
Allow: GET, POST, OPTIONS
Content-Length: 1
Content-Type: text/plain; charset=UTF-8
Client-Date: Mon, 10 Oct 2016 00:20:35 GMT
Client-Peer: 208.94.116.75:80
Client-Response-Num: 1




Web links


Copyright © Ben Bullock 2009-2023. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (benkasminbullock@gmail.com) or use the discussion group at Google Groups. / Privacy / Disclaimer