Initial public release
This commit is contained in:
brent saner
2024-12-12 03:47:30 -05:00
parent db081e2699
commit 3967e5fdb7
4 changed files with 108 additions and 293 deletions

View File

@@ -11,7 +11,7 @@
{{- if $page.Raw }}
<h3 id="client_raw">Raw Block ({{ $page.RawFmt }})<a href="#client_raw">{{ $linkico }}</a></h3>
<p>
{{- if $page.DoRawIndent }}
{{- if $page.DoIndent }}
<pre>{{ $page.Raw }}</pre>
{{- else }}
<code>{{ $page.Raw }}</code>
@@ -20,36 +20,64 @@
{{- end }}
<h3 id="client_ua">User Agent Information<a href="#client_ua">{{ $linkico }}</a></h3>
<p>This is information that your browser sends to identify itself.</p>
{{- range $idx, $ua := $page.Info.Client }}
<p>
{{- range $idx, $ua := $page.Info.Client }}
User Agent ({{ $idx }}):
<div class="tg-wrap">
<table>
<thead>
<tr>
<th>Identifier</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{{- $flds := $ua.ToMap }}
{{- range $fld, $str := $flds }}
<tr>
<td>{{ $fld }}</td>
<td>{{ $str }}</td>
</tr>
{{- end }}
</tbody>
</table>
</div>
{{- /*
<ul>
{{- $flds := $ua.ToMap }}
{{- range $fld, $str := $flds }}
<li><b>{{ $fld }}:</b> {{ $str }}</li>
{{- end }}
</ul>
{{- end }}
*/}}
</p>
{{- end }}
<h3 id="client_hdrs">Request Headers<a href="#client_hdrs">{{ $linkico }}</a></h3>
<p>
These are headers sent along with the request your browser sends for the page's content.
Note that some headers may have multiple values.
</p>
<p>
<table>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
{{- range $hdrNm, $hdrVals := $page.Info.Req.Header }}
<tr>
{{- range $val := $hdrVals }}
<td>{{ $hdrNm }}</td>
<td>{{ $val }}</td>
{{- end }}
</tr>
{{- end }}
</table>
<div class="tg-wrap">
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{{- range $hdrNm, $hdrVals := $page.Info.Req.Header }}
<tr>
{{- range $val := $hdrVals }}
<td>{{ $hdrNm }}</td>
<td>{{ $val }}</td>
{{- end }}
</tr>
{{- end }}
</tbody>
</table>
</div>
</p>
{{- end }}

View File

@@ -5,8 +5,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ getTitle $page.PageType }}</title>
{{- /*
<!-- Bootstrap core CSS -->
<!--
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
@@ -24,30 +25,51 @@
<!--
<link href="https://getbootstrap.com/docs/4.0/examples/offcanvas/offcanvas.css" rel="stylesheet">
-->
*/}}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.3/dist/lux/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation"><a href="/">Home</a></li>
<li role="presentation"><a href="/about">About</a></li>
<li role="presentation"><a href="/usage">Usage</a></li>
<ul role="presentation">
<li><a href="/?mime=application/json&indent">JSON</a></li>
<li><a href="/?mime=application/xml&indent">XML</a></li>
<li><a href="/?mime=application/yaml">YAML</a></li>
<li><a href="/?mime=text/html">HTML (This Page)</a></li>
</ul>
<!--
the following opens in a new tab/window/whatever.
the line after opens in the same tab/window/etc.
-->
<!--
<li role="presentation"><a href="https://r00t2.io/" target="_blank">r00t^2</a></li>
-->
<li role="presentation"><a href="https://r00t2.io/">r00t^2</a></li>
</ul>
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="/">Home</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto"> <!-- ms-auto replaces pull-right for alignment -->
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/usage">Usage</a>
</li>
<!-- Dropdown Menu -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">Formats/MIME types</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="/?mime=application/json&indent">JSON (<code>application/json</code>)</a></li>
<li><a class="dropdown-item" href="/?mime=application/xml&indent">XML (<code>application/xml</code>)</a></li>
<li><a class="dropdown-item" href="/?mime=application/yaml">YAML (<code>application/yaml</code>)</a></li>
{{- if eq $page.PageType "index" }}
<li><a class="dropdown-item" href="/?mime=text/html">HTML (this page) (<code>text/html</code>)</a></li>
{{- else }}
<li><a class="dropdown-item" href="/?mime=text/html">HTML (<code>text/html</code>)</a></li>
{{- end }}
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="https://r00t2.io/" target="_blank">r00t^2</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
{{- end }}

View File

@@ -17,10 +17,10 @@
You can force a specific raw output by specifying the <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">MIME type</a> via
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#section-12.5.1">the <code>Accept</code> header (RFC 9110 &sect; 12.5.1)</a>, which may be one of:
<ul>
<li><code>application/json</code> for <a href="https://www.rfc-editor.org/rfc/rfc8259.html">JSON</a></li>
<li><code>application/xml</code> for <a href="https://www.rfc-editor.org/rfc/rfc7303.html">XML</a></li>
<li><code>application/yaml</code> for <a href="https://www.rfc-editor.org/rfc/rfc9512.html">YAML</a></li>
<li><code>text/html</code> for <a href="https://www.rfc-editor.org/rfc/rfc2854.html">HTML</a></li>
<li><code>application/json</code> for JSON (<a href="https://www.rfc-editor.org/rfc/rfc8259.html">RFC 8259</a>, <a href="https://www.iana.org/assignments/media-types/application/json">IANA registration</a>)</li>
<li><code>application/xml</code> for XML (<a href="https://www.rfc-editor.org/rfc/rfc7303.html">RFC 7303</a>, <a href="https://www.iana.org/assignments/media-types/application/xml">IANA registration</a>)</li>
<li><code>application/yaml</code> for YAML (<a href="https://www.rfc-editor.org/rfc/rfc9512.html">RFC 9512</a>, <a href="https://www.iana.org/assignments/media-types/application/yaml">IANA registration</a>)</li>
<li><code>text/html</code> for HTML (<a href="https://www.rfc-editor.org/rfc/rfc2854.html">RFC 2854</a>, <a href="https://www.iana.org/assignments/media-types/text/html">IANA registration</a>)</li>
</ul>
For example: <code>Accept: application/json</code> will return JSON.
<br/>
@@ -36,8 +36,15 @@
If no selectable MIME type is provided but an <code>Accept</code> was given, an error will be returned; specifically, a
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.7"><code>406</code> status code (RFC 9110 &sect; 15.5.7)</a>.
In this case, supported MIME types will be returned in the response's <code>Accept</code> header.
<br/>
In this case, supported MIME types will be returned in the response's <code>Accept</code> header values, e.g.:
<p>
<pre>
Accept: application/json
Accept: application/xml
Accept: application/yaml
Accept: text/html
</pre>
</p>
Note that <a href="https://lynx.invisible-island.net/">Lynx</a> and <a href="http://elinks.or.cz/">Elinks</a> are considered "graphical"
browsers by this program as they are HTML-centric.
@@ -46,7 +53,7 @@
The following parameters control/modify behavior.<a href="#usage_params_mod">{{ $linkico }}</a>
<ul>
<li>
<b>mime:</b> Specify an explicit MIME type via URL instead of the <code>Accept</code> header as specified above.
<b><code>mime</code>:</b> Specify an explicit MIME type via URL instead of the <code>Accept</code> header as specified above.
<ul>
<li>This should only be used by clients in which it is impossible or particularly cumbersome to modify/specify headers.
<code>Accept</code> is more performant.</li>
@@ -56,7 +63,7 @@
</ul>
</li>
<li>
<b>include:</b> Include a <code>&lt;code&gt;</code> (or <code>&lt;pre&gt;</code>, depending on if indentation is needed/requested) block in the HTML for the specified MIME type as well.</li>
<b><code>include</code>:</b> Include a <code>&lt;code&gt;</code> (or <code>&lt;pre&gt;</code>, depending on if indentation is needed/requested) block in the HTML for the specified MIME type as well.</li>
<ul>
<li>Only the first supported instance of this parameter will be used.</li>
<li>
@@ -70,7 +77,7 @@
</ul>
</li>
<li>
<b>indent:</b> Enable/specify indentation for JSON and XML output; ignored for others.
<b><code>indent</code>:</b> Enable/specify indentation for JSON and XML output; ignored for others.
<ul>
<li>The default is to not indent. (Commonly referred to as "condensed" or "compressed" JSON/XML.)</li>
<li>Only the first specified instance of this parameter will be used.</li>