Files
metasploit-gs/api/Rex/Proto/Http/Response.html
T
jenkins-metasploit c3f5bd3de2 Reboot gh-pages
2026-05-08 17:08:43 +00:00

1954 lines
63 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: Rex::Proto::Http::Response
&mdash; Documentation by YARD 0.9.37
</title>
<link rel="stylesheet" href="../../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Rex::Proto::Http::Response";
relpath = '../../../';
</script>
<script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../../_index.html">Index (R)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../../Rex.html" title="Rex (module)">Rex</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Proto.html" title="Rex::Proto (module)">Proto</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Http.html" title="Rex::Proto::Http (module)">Http</a></span></span>
&raquo;
<span class="title">Response</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Class: Rex::Proto::Http::Response
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName"><span class='object_link'><a href="Packet.html" title="Rex::Proto::Http::Packet (class)">Packet</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next"><span class='object_link'><a href="Packet.html" title="Rex::Proto::Http::Packet (class)">Packet</a></span></li>
<li class="next">Rex::Proto::Http::Response</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/rex/proto/http/response.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>HTTP response class.</p>
</div>
</div>
<div class="tags">
</div><div id="subclasses">
<h2>Direct Known Subclasses</h2>
<p class="children"><span class='object_link'><a href="../../../Msf/Auxiliary/Web/HTTP/Response.html" title="Msf::Auxiliary::Web::HTTP::Response (class)">Msf::Auxiliary::Web::HTTP::Response</a></span>, <span class='object_link'><a href="../../../Msf/Exploit/Git/Lfs/Response.html" title="Msf::Exploit::Git::Lfs::Response (class)">Msf::Exploit::Git::Lfs::Response</a></span>, <span class='object_link'><a href="../../../Msf/Exploit/Git/SmartHttp/Response.html" title="Msf::Exploit::Git::SmartHttp::Response (class)">Msf::Exploit::Git::SmartHttp::Response</a></span>, <span class='object_link'><a href="Response/E404.html" title="Rex::Proto::Http::Response::E404 (class)">E404</a></span>, <span class='object_link'><a href="Response/OK.html" title="Rex::Proto::Http::Response::OK (class)">OK</a></span></p>
</div>
<h2>Defined Under Namespace</h2>
<p class="children">
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Response/E404.html" title="Rex::Proto::Http::Response::E404 (class)">E404</a></span>, <span class='object_link'><a href="Response/OK.html" title="Rex::Proto::Http::Response::OK (class)">OK</a></span>
</p>
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#code-instance_method" title="#code (instance method)">#<strong>code</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute code.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#count_100-instance_method" title="#count_100 (instance method)">#<strong>count_100</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute count_100.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#message-instance_method" title="#message (instance method)">#<strong>message</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute message.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#peerinfo-instance_method" title="#peerinfo (instance method)">#<strong>peerinfo</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Host address:port associated with this request/response.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#proto-instance_method" title="#proto (instance method)">#<strong>proto</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute proto.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#request-instance_method" title="#request (instance method)">#<strong>request</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Used to store a copy of the original request.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Packet.html" title="Rex::Proto::Http::Packet (class)">Packet</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Packet.html#auto_cl-instance_method" title="Rex::Proto::Http::Packet#auto_cl (method)">#auto_cl</a></span>, <span class='object_link'><a href="Packet.html#body-instance_method" title="Rex::Proto::Http::Packet#body (method)">#body</a></span>, <span class='object_link'><a href="Packet.html#body_bytes_left-instance_method" title="Rex::Proto::Http::Packet#body_bytes_left (method)">#body_bytes_left</a></span>, <span class='object_link'><a href="Packet.html#bufq-instance_method" title="Rex::Proto::Http::Packet#bufq (method)">#bufq</a></span>, <span class='object_link'><a href="Packet.html#chunk_max_size-instance_method" title="Rex::Proto::Http::Packet#chunk_max_size (method)">#chunk_max_size</a></span>, <span class='object_link'><a href="Packet.html#chunk_min_size-instance_method" title="Rex::Proto::Http::Packet#chunk_min_size (method)">#chunk_min_size</a></span>, <span class='object_link'><a href="Packet.html#compress-instance_method" title="Rex::Proto::Http::Packet#compress (method)">#compress</a></span>, <span class='object_link'><a href="Packet.html#error-instance_method" title="Rex::Proto::Http::Packet#error (method)">#error</a></span>, <span class='object_link'><a href="Packet.html#headers-instance_method" title="Rex::Proto::Http::Packet#headers (method)">#headers</a></span>, <span class='object_link'><a href="Packet.html#incomplete-instance_method" title="Rex::Proto::Http::Packet#incomplete (method)">#incomplete</a></span>, <span class='object_link'><a href="Packet.html#inside_chunk-instance_method" title="Rex::Proto::Http::Packet#inside_chunk (method)">#inside_chunk</a></span>, <span class='object_link'><a href="Packet.html#keepalive-instance_method" title="Rex::Proto::Http::Packet#keepalive (method)">#keepalive</a></span>, <span class='object_link'><a href="Packet.html#max_data-instance_method" title="Rex::Proto::Http::Packet#max_data (method)">#max_data</a></span>, <span class='object_link'><a href="Packet.html#state-instance_method" title="Rex::Proto::Http::Packet#state (method)">#state</a></span>, <span class='object_link'><a href="Packet.html#transfer_chunked-instance_method" title="Rex::Proto::Http::Packet#transfer_chunked (method)">#transfer_chunked</a></span></p>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#check_100-instance_method" title="#check_100 (instance method)">#<strong>check_100</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Allow 100 Continues to be ignored by the caller.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#cmd_string-instance_method" title="#cmd_string (instance method)">#<strong>cmd_string</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the response based command string.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_cookies-instance_method" title="#get_cookies (instance method)">#<strong>get_cookies</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Gets cookies from the Set-Cookie header in a format to be used in the cookie send_request field.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_cookies_parsed-instance_method" title="#get_cookies_parsed (instance method)">#<strong>get_cookies_parsed</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Gets cookies from the Set-Cookie header in a parsed format.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_hidden_inputs-instance_method" title="#get_hidden_inputs (instance method)">#<strong>get_hidden_inputs</strong> &#x21d2; Array&lt;Hash&gt; </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns a collection of found hidden inputs.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_html_document-instance_method" title="#get_html_document (instance method)">#<strong>get_html_document</strong> &#x21d2; Nokogiri::HTML::Document </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns a parsed HTML document.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_html_meta_elements-instance_method" title="#get_html_meta_elements (instance method)">#<strong>get_html_meta_elements</strong> &#x21d2; Array&lt;Nokogiri::XML::Element&gt; </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns meta tags.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_html_scripts-instance_method" title="#get_html_scripts (instance method)">#<strong>get_html_scripts</strong> &#x21d2; Array&lt;RKelly::Nodes::SourceElementsNode&gt; </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns parsed JavaScript blocks.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_json_document-instance_method" title="#get_json_document (instance method)">#<strong>get_json_document</strong> &#x21d2; Hash </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns a parsed json document.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#get_xml_document-instance_method" title="#get_xml_document (instance method)">#<strong>get_xml_document</strong> &#x21d2; Nokogiri::XML::Document </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Returns a parsed XML document.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#gzip_decode-instance_method" title="#gzip_decode (instance method)">#<strong>gzip_decode</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#gzip_decode!-instance_method" title="#gzip_decode! (instance method)">#<strong>gzip_decode!</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(code = 200, message = &#39;OK&#39;, proto = DefaultProtocol) &#x21d2; Response </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Constructage of the HTTP response with the supplied code, message, and protocol.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#redirect%3F-instance_method" title="#redirect? (instance method)">#<strong>redirect?</strong> &#x21d2; Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Answers if the response is a redirection one.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#redirection-instance_method" title="#redirection (instance method)">#<strong>redirection</strong> &#x21d2; URI<sup>?</sup> </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Provides the uri of the redirection location.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#update_cmd_parts-instance_method" title="#update_cmd_parts (instance method)">#<strong>update_cmd_parts</strong>(str) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Updates the various parts of the HTTP response command string.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Packet.html" title="Rex::Proto::Http::Packet (class)">Packet</a></span></h3>
<p class="inherited"><span class='object_link'><a href="Packet.html#[]-instance_method" title="Rex::Proto::Http::Packet#[] (method)">#[]</a></span>, <span class='object_link'><a href="Packet.html#[]=-instance_method" title="Rex::Proto::Http::Packet#[]= (method)">#[]=</a></span>, <span class='object_link'><a href="Packet.html#chunk-instance_method" title="Rex::Proto::Http::Packet#chunk (method)">#chunk</a></span>, <span class='object_link'><a href="Packet.html#completed%3F-instance_method" title="Rex::Proto::Http::Packet#completed? (method)">#completed?</a></span>, <span class='object_link'><a href="Packet.html#from_s-instance_method" title="Rex::Proto::Http::Packet#from_s (method)">#from_s</a></span>, <span class='object_link'><a href="Packet.html#output_packet-instance_method" title="Rex::Proto::Http::Packet#output_packet (method)">#output_packet</a></span>, <span class='object_link'><a href="Packet.html#parse-instance_method" title="Rex::Proto::Http::Packet#parse (method)">#parse</a></span>, <span class='object_link'><a href="Packet.html#parse_body-instance_method" title="Rex::Proto::Http::Packet#parse_body (method)">#parse_body</a></span>, <span class='object_link'><a href="Packet.html#parse_header-instance_method" title="Rex::Proto::Http::Packet#parse_header (method)">#parse_header</a></span>, <span class='object_link'><a href="Packet.html#reset-instance_method" title="Rex::Proto::Http::Packet#reset (method)">#reset</a></span>, <span class='object_link'><a href="Packet.html#reset_except_queue-instance_method" title="Rex::Proto::Http::Packet#reset_except_queue (method)">#reset_except_queue</a></span>, <span class='object_link'><a href="Packet.html#to_s-instance_method" title="Rex::Proto::Http::Packet#to_s (method)">#to_s</a></span>, <span class='object_link'><a href="Packet.html#to_terminal_output-instance_method" title="Rex::Proto::Http::Packet#to_terminal_output (method)">#to_terminal_output</a></span></p>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(code = 200, message = &#39;OK&#39;, proto = DefaultProtocol) &#x21d2; <tt><span class='object_link'><a href="" title="Rex::Proto::Http::Response (class)">Response</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Constructage of the HTTP response with the supplied code, message, and protocol.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span> <span class='op'>=</span> <span class='int'>200</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>OK</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_proto'>proto</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Http.html#DefaultProtocol-constant" title="Rex::Proto::Http::DefaultProtocol (constant)">DefaultProtocol</a></span></span><span class='rparen'>)</span>
<span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>=</span> <span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_message'>message</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_proto'>proto</span> <span class='op'>=</span> <span class='id identifier rubyid_proto'>proto</span>
<span class='comment'># Default responses to auto content length on
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_auto_cl'>auto_cl</span> <span class='op'>=</span> <span class='kw'>true</span>
<span class='comment'># default chunk sizes (if chunked is used)
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_chunk_min_size'>chunk_min_size</span> <span class='op'>=</span> <span class='int'>1</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_chunk_max_size'>chunk_max_size</span> <span class='op'>=</span> <span class='int'>10</span>
<span class='comment'># 100 continue counter
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_count_100'>count_100</span> <span class='op'>=</span> <span class='int'>0</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id="code=-instance_method"></span>
<div class="method_details first">
<h3 class="signature first" id="code-instance_method">
#<strong>code</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute code.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
255
256
257</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 255</span>
<span class='kw'>def</span> <span class='id identifier rubyid_code'>code</span>
<span class='ivar'>@code</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="count_100=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="count_100-instance_method">
#<strong>count_100</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute count_100.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
258
259
260</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 258</span>
<span class='kw'>def</span> <span class='id identifier rubyid_count_100'>count_100</span>
<span class='ivar'>@count_100</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="message=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="message-instance_method">
#<strong>message</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute message.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
256
257
258</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 256</span>
<span class='kw'>def</span> <span class='id identifier rubyid_message'>message</span>
<span class='ivar'>@message</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="peerinfo=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="peerinfo-instance_method">
#<strong>peerinfo</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Host address:port associated with this request/response</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
253
254
255</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 253</span>
<span class='kw'>def</span> <span class='id identifier rubyid_peerinfo'>peerinfo</span>
<span class='ivar'>@peerinfo</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="proto=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="proto-instance_method">
#<strong>proto</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute proto.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
257
258
259</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 257</span>
<span class='kw'>def</span> <span class='id identifier rubyid_proto'>proto</span>
<span class='ivar'>@proto</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="request=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="request-instance_method">
#<strong>request</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Used to store a copy of the original request</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
248
249
250</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 248</span>
<span class='kw'>def</span> <span class='id identifier rubyid_request'>request</span>
<span class='ivar'>@request</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="check_100-instance_method">
#<strong>check_100</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Allow 100 Continues to be ignored by the caller</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
213
214
215
216
217
218
219</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 213</span>
<span class='kw'>def</span> <span class='id identifier rubyid_check_100'>check_100</span>
<span class='comment'># If this was a 100 continue with no data, reset
</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>==</span> <span class='int'>100</span> <span class='kw'>and</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_body_bytes_left'>body_bytes_left</span> <span class='op'>==</span> <span class='op'>-</span><span class='int'>1</span> <span class='kw'>or</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_body_bytes_left'>body_bytes_left</span> <span class='op'>==</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_count_100'>count_100</span> <span class='op'>&lt;</span> <span class='int'>5</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset_except_queue'>reset_except_queue</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_count_100'>count_100</span> <span class='op'>+=</span> <span class='int'>1</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="cmd_string-instance_method">
#<strong>cmd_string</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the response based command string.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
241
242
243</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 241</span>
<span class='kw'>def</span> <span class='id identifier rubyid_cmd_string'>cmd_string</span>
<span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HTTP\/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_proto'>proto</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_code'>code</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span> <span class='kw'>and</span> <span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'> </span><span class='tstring_end'>&#39;</span></span> <span class='op'>+</span> <span class='id identifier rubyid_message'>message</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='embexpr_end'>}</span><span class='tstring_content'>\r\n</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_cookies-instance_method">
#<strong>get_cookies</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Gets cookies from the Set-Cookie header in a format to be used in the cookie send_request field</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 68</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_cookies'>get_cookies</span>
<span class='id identifier rubyid_cookies'>cookies</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Set-Cookie</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_set_cookies'>set_cookies</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Set-Cookie</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_key_vals'>key_vals</span> <span class='op'>=</span> <span class='id identifier rubyid_set_cookies'>set_cookies</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\s?([^, ;]+?)=([^, ;]*?)[;,]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_key_vals'>key_vals</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
<span class='comment'># Dont downcase actual cookie name as may be case sensitive
</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>path</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>expires</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>domain</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>max-age</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_cookies'>cookies</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_v'>v</span><span class='embexpr_end'>}</span><span class='tstring_content'>; </span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>return</span> <span class='id identifier rubyid_cookies'>cookies</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_cookies_parsed-instance_method">
#<strong>get_cookies_parsed</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Gets cookies from the Set-Cookie header in a parsed format</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
90
91
92
93
94
95
96
97</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 90</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_cookies_parsed'>get_cookies_parsed</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Set-Cookie</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='const'>CGI</span><span class='op'>::</span><span class='const'>Cookie</span><span class='op'>::</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Set-Cookie</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_ret'>ret</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_ret'>ret</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_hidden_inputs-instance_method">
#<strong>get_hidden_inputs</strong> &#x21d2; <tt>Array&lt;Hash&gt;</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a collection of found hidden inputs</p>
</div>
</div>
<div class="tags">
<div class="examples">
<h4 class="tag_title">Examples:</h4>
<pre class="example code"><code><span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_send_request_cgi'>send_request_cgi</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>uri</span><span class='tstring_end'>&#39;</span></span><span class='op'>=&gt;</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_inputs'>inputs</span> <span class='op'>=</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_get_hidden_inputs'>get_hidden_inputs</span>
<span class='id identifier rubyid_session_id'>session_id</span> <span class='op'>=</span> <span class='id identifier rubyid_inputs'>inputs</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>sessionid</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='comment'># The first form&#39;s &#39;sessionid&#39; hidden input</span></code></pre>
</div>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array&lt;Hash&gt;</tt>)</span>
&mdash;
<div class='inline'>
<p>An array, each element represents a form that contains a hash of found hidden inputs</p>
<ul><li>
<p>'name' [String] The hidden input's original name. The value is the hidden input's original value.</p>
</li></ul>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 176</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_hidden_inputs'>get_hidden_inputs</span>
<span class='id identifier rubyid_forms'>forms</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_noko'>noko</span> <span class='op'>=</span> <span class='id identifier rubyid_get_html_document'>get_html_document</span>
<span class='id identifier rubyid_noko'>noko</span><span class='period'>.</span><span class='id identifier rubyid_search'>search</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>form</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_entry'>each_entry</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_form'>form</span><span class='op'>|</span>
<span class='id identifier rubyid_found_inputs'>found_inputs</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='id identifier rubyid_form'>form</span><span class='period'>.</span><span class='id identifier rubyid_search'>search</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>input</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_entry'>each_entry</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_input'>input</span><span class='op'>|</span>
<span class='id identifier rubyid_input_type'>input_type</span> <span class='op'>=</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>type</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>type</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
<span class='kw'>next</span> <span class='kw'>if</span> <span class='id identifier rubyid_input_type'>input_type</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>hidden</span><span class='regexp_end'>/i</span></span>
<span class='id identifier rubyid_input_name'>input_name</span> <span class='op'>=</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>name</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>name</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_input_value'>input_value</span> <span class='op'>=</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>value</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>value</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_found_inputs'>found_inputs</span><span class='lbracket'>[</span><span class='id identifier rubyid_input_name'>input_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_input_value'>input_value</span> <span class='kw'>unless</span> <span class='id identifier rubyid_input_name'>input_name</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_forms'>forms</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_found_inputs'>found_inputs</span> <span class='kw'>unless</span> <span class='id identifier rubyid_found_inputs'>found_inputs</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_forms'>forms</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_html_document-instance_method">
#<strong>get_html_document</strong> &#x21d2; <tt>Nokogiri::HTML::Document</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a parsed HTML document. Instead of using regexes to parse the HTML body, you should use this and use the Nokogiri API.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Nokogiri::HTML::Document</tt>)</span>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><a href="http://www.nokogiri.org/" target="_parent" title="http://www.nokogiri.org/">http://www.nokogiri.org/</a></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
105
106
107</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 105</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_html_document'>get_html_document</span>
<span class='const'>Nokogiri</span><span class='op'>::</span><span class='const'>HTML</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_html_meta_elements-instance_method">
#<strong>get_html_meta_elements</strong> &#x21d2; <tt>Array&lt;Nokogiri::XML::Element&gt;</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns meta tags. You will probably want to use this the web apps version info (or other stuff) can be found in the metadata.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array&lt;Nokogiri::XML::Element&gt;</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
149
150
151
152</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 149</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_html_meta_elements'>get_html_meta_elements</span>
<span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='id identifier rubyid_get_html_document'>get_html_document</span>
<span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_search'>search</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>//meta</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_html_scripts-instance_method">
#<strong>get_html_scripts</strong> &#x21d2; <tt>Array&lt;RKelly::Nodes::SourceElementsNode&gt;</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns parsed JavaScript blocks. The parsed version is a RKelly object that allows you to be able do advanced parsing.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Array&lt;RKelly::Nodes::SourceElementsNode&gt;</tt>)</span>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><a href="https://github.com/tenderlove/rkelly" target="_parent" title="https://github.com/tenderlove/rkelly">https://github.com/tenderlove/rkelly</a></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
159
160
161
162
163
164
165</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 159</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_html_scripts'>get_html_scripts</span>
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>rkelly</span><span class='tstring_end'>&#39;</span></span>
<span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='id identifier rubyid_get_html_document'>get_html_document</span>
<span class='id identifier rubyid_rkelly'>rkelly</span> <span class='op'>=</span> <span class='const'>RKelly</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_search'>search</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>//script</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_rkelly'>rkelly</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_json_document-instance_method">
#<strong>get_json_document</strong> &#x21d2; <tt>Hash</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a parsed json document. Instead of using regexes to parse the JSON body, you should use this.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Hash</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
132
133
134
135
136
137
138
139
140
141
142</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 132</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_json_document'>get_json_document</span>
<span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
<span class='kw'>begin</span>
<span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
<span class='kw'>rescue</span> <span class='const'>JSON</span><span class='op'>::</span><span class='const'>ParserError</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
<span class='id identifier rubyid_elog'><span class='object_link'><a href="../../../top-level-namespace.html#elog-instance_method" title="#elog (method)">elog</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_json'>json</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="get_xml_document-instance_method">
#<strong>get_xml_document</strong> &#x21d2; <tt>Nokogiri::XML::Document</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Returns a parsed XML document. Instead of using regexes to parse the XML body, you should use this and use the Nokogiri API.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Nokogiri::XML::Document</tt>)</span>
</li>
</ul>
<p class="tag_title">See Also:</p>
<ul class="see">
<li><a href="http://www.nokogiri.org/" target="_parent" title="http://www.nokogiri.org/">http://www.nokogiri.org/</a></li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
114
115
116</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 114</span>
<span class='kw'>def</span> <span class='id identifier rubyid_get_xml_document'>get_xml_document</span>
<span class='const'>Nokogiri</span><span class='op'>::</span><span class='const'>XML</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="gzip_decode-instance_method">
#<strong>gzip_decode</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
122
123
124
125
126</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 122</span>
<span class='kw'>def</span> <span class='id identifier rubyid_gzip_decode'>gzip_decode</span>
<span class='id identifier rubyid_gz'>gz</span> <span class='op'>=</span> <span class='const'>Zlib</span><span class='op'>::</span><span class='const'>GzipReader</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>StringIO</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='id identifier rubyid_gz'>gz</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="gzip_decode!-instance_method">
#<strong>gzip_decode!</strong> &#x21d2; <tt>Object</tt>
</h3><table class="source_code">
<tr>
<td>
<pre class="lines">
118
119
120</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 118</span>
<span class='kw'>def</span> <span class='id identifier rubyid_gzip_decode!'>gzip_decode!</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_gzip_decode'>gzip_decode</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="redirect?-instance_method">
#<strong>redirect?</strong> &#x21d2; <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Answers if the response is a redirection one.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
&mdash;
<div class='inline'>
<p>true if the response is a redirection, false otherwise.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
224
225
226</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 224</span>
<span class='kw'>def</span> <span class='id identifier rubyid_redirect?'>redirect?</span>
<span class='lbracket'>[</span><span class='int'>301</span><span class='comma'>,</span> <span class='int'>302</span><span class='comma'>,</span> <span class='int'>303</span><span class='comma'>,</span> <span class='int'>307</span><span class='comma'>,</span> <span class='int'>308</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="redirection-instance_method">
#<strong>redirection</strong> &#x21d2; <tt>URI</tt><sup>?</sup>
</h3><div class="docstring">
<div class="discussion">
<p>Provides the uri of the redirection location.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>URI</tt>)</span>
&mdash;
<div class='inline'>
<p>the uri of the redirection location.</p>
</div>
</li>
<li>
<span class='type'>(<tt>nil</tt>)</span>
&mdash;
<div class='inline'>
<p>if the response hasn't a Location header or it isn't a valid uri.</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
232
233
234
235
236</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 232</span>
<span class='kw'>def</span> <span class='id identifier rubyid_redirection'>redirection</span>
<span class='const'>URI</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Location</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>rescue</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>URI</span><span class='op'>::</span><span class='const'>InvalidURIError</span>
<span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="update_cmd_parts-instance_method">
#<strong>update_cmd_parts</strong>(str) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Updates the various parts of the HTTP response command string.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
198
199
200
201
202
203
204
205
206
207
208</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/proto/http/response.rb', line 198</span>
<span class='kw'>def</span> <span class='id identifier rubyid_update_cmd_parts'>update_cmd_parts</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_md'>md</span> <span class='op'>=</span> <span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>HTTP\/(.+?)\s+(\d+)\s?(.+?)\r?\n?$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_md'>md</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\r</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span> <span class='op'>=</span> <span class='id identifier rubyid_md'>md</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_proto'>proto</span> <span class='op'>=</span> <span class='id identifier rubyid_md'>md</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid response command string</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_caller'>caller</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_check_100'>check_100</span><span class='lparen'>(</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:04:15 2026 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.37 (ruby-3.1.5).
</div>
</div>
</body>
</html>