Archive-Har
view release on metacpan or search on metacpan
t/firebug_post.t view on Meta::CPAN
#!perl -T
use Test::More tests => 52;
use Archive::Har();
use Compress::Zlib();
use JSON();
my $har = Archive::Har->new();
my $firebug_post_string = <<'_FIREBUG_RESULTS_';
{
"log": {
"version": "1.1",
"creator": {
"name": "Firebug",
"version": "1.9"
},
"browser": {
"name": "Firefox",
"version": "11.0"
},
"pages": [
{
"startedDateTime": "2012-03-23T16:31:05.716+11:00",
"id": "page_40125",
"title": "DuckDuckGo",
"pageTimings": {
"onContentLoad": 547,
"onLoad": 3987
}
}
],
"entries": [
{
"pageref": "page_40125",
"startedDateTime": "2012-03-23T16:31:05.716+11:00",
"time": 381,
"request": {
"method": "POST",
"url": "https://duckduckgo.com/",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Host",
"value": "duckduckgo.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/2010.111 Firefox/11.0"
},
{
"name": "Accept",
"value": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
},
{
"name": "Accept-Language",
"value": "en-us,en;q=0.5"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate"
},
{
"name": "Connection",
"value": "keep-alive"
}
],
"queryString": [],
"postData": {
"mimeType": "application/x-www-form-urlencoded",
"params": [
{
"name": "kg",
"value": "p"
},
{
"name": "q",
"value": "http archive format"
}
],
"text": ""
},
"headersSize": 287,
"bodySize": 97
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Server",
"value": "nginx"
},
{
"name": "Date",
"value": "Fri, 23 Mar 2012 05:27:52 GMT"
},
{
"name": "Content-Type",
"value": "text/html; charset=UTF-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Expires",
"value": "Fri, 23 Mar 2012 05:27:53 GMT"
},
{
"name": "Cache-Control",
"value": "max-age=1"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"content": {
"mimeType": "text/html",
"size": 6730,
"text": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html><head><meta name=\"robots\" content=\"noindex,nofollow\"><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"><...
},
"redirectURL": "",
"headersSize": 253,
"bodySize": 2673
},
"cache": {
"afterRequest": {
"expires": "1970-01-01T00:00:00.000Z",
"lastAccess": "2012-03-23T05:31:06.000Z",
"eTag": "",
"hitCount": 119
}
},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 0,
"send": 0,
"wait": 381,
"receive": 0
},
"serverIPAddress": "184.72.106.52",
"connection": "443"
},
{
"pageref": "page_40125",
"startedDateTime": "2012-03-23T16:31:06.275+11:00",
"time": 760,
"request": {
"method": "GET",
"url": "https://duckduckgo.com/a.js?q=http%20archive%20format&p=1",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Host",
"value": "duckduckgo.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/2010.111 Firefox/11.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "en-us,en;q=0.5"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://duckduckgo.com/"
}
],
"queryString": [
{
"name": "p",
"value": "1"
},
{
"name": "q",
"value": "http archive format"
}
],
"headersSize": 296,
"bodySize": -1
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Server",
"value": "nginx"
},
{
"name": "Date",
"value": "Fri, 23 Mar 2012 05:27:53 GMT"
},
{
"name": "Content-Type",
"value": "application/x-javascript; charset=UTF-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Expires",
"value": "Fri, 23 Mar 2012 05:27:52 GMT"
},
{
"name": "Cache-Control",
"value": "no-cache"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"content": {
"mimeType": "application/x-javascript",
"size": 691,
"text": "var dna=[{\"u\":\"https://en.wikipedia.org/wiki/Darwin_Core_Archive#Archive_Format\",\"h\":\"Darwin Core <b>Archive</b>: <b>Archive Format</b>\",\"a\":\"Sharing entire datasets instead of using pageable web services like DiGIR an...
},
"redirectURL": "",
"headersSize": 267,
"bodySize": 451
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 0,
"send": 0,
"wait": 760,
"receive": 0
},
"serverIPAddress": "184.72.106.52",
"connection": "443"
},
{
"pageref": "page_40125",
"startedDateTime": "2012-03-23T16:31:06.275+11:00",
"time": 1818,
"request": {
"method": "GET",
"url": "https://duckduckgo.com/d.js?q=http%20archive%20format&l=us-en&p=1&s=0",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Host",
"value": "duckduckgo.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/2010.111 Firefox/11.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "en-us,en;q=0.5"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://duckduckgo.com/"
}
],
"queryString": [
{
"name": "l",
"value": "us-en"
},
{
"name": "p",
"value": "1"
},
{
"name": "q",
"value": "http archive format"
},
{
"name": "s",
"value": "0"
}
],
"headersSize": 308,
"bodySize": -1
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Server",
"value": "nginx"
},
{
"name": "Date",
"value": "Fri, 23 Mar 2012 05:27:54 GMT"
},
{
"name": "Content-Type",
"value": "application/x-javascript; charset=UTF-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Expires",
"value": "Fri, 23 Mar 2012 05:27:53 GMT"
},
{
"name": "Cache-Control",
"value": "no-cache"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"content": {
"mimeType": "application/x-javascript",
"size": 13874,
"text": "if (nrn) nrn('d',[{\"a\":\"An <b>archive</b> <b>format</b> is the file <b>format</b> of an <b>archive</b> file. The <b>archive</b> <b>format</b> is determined by the file archiver. ... Retrieved from "<b>http</b>://en.wikipe...
},
"redirectURL": "",
"headersSize": 267,
"bodySize": 4718
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 723,
"send": 0,
"wait": 1095,
"receive": 0
},
"serverIPAddress": "184.72.106.52",
"connection": "443"
},
{
"pageref": "page_40125",
"startedDateTime": "2012-03-23T16:31:08.319+11:00",
"time": 1330,
"request": {
"method": "GET",
"url": "https://builder.duckduckgo.com/b.js?q=http%20archive%20format",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Host",
"value": "builder.duckduckgo.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/2010.111 Firefox/11.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "en-us,en;q=0.5"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://duckduckgo.com/"
}
],
"queryString": [
{
"name": "q",
"value": "http archive format"
}
],
"headersSize": 300,
"bodySize": -1
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{
"name": "Server",
"value": "nginx"
},
{
"name": "Date",
"value": "Fri, 23 Mar 2012 05:27:55 GMT"
},
{
( run in 1.072 second using v1.01-cache-2.11-cpan-39bf76dae61 )