https://script.quakenet.org/wiki/index.php?title=MHTTP&feed=atom&action=history
MHTTP - Revision history
2024-03-29T13:10:13Z
Revision history for this page on the wiki
MediaWiki 1.27.2
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6154&oldid=prev
Aca20031: Adding known issue about not supporting arrays in POST
2015-06-10T21:02:14Z
<p>Adding known issue about not supporting arrays in POST</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 21:02, 10 June 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l59" >Line 59:</td>
<td colspan="2" class="diff-lineno">Line 59:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Known issues:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Known issues:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>  ;    Cookies do not respect attributes such as domain, path, expiration, or secure. They <del class="diffchange diffchange-inline">area </del>always sent</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"> ;    POSTing arrays is not currently supported</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>  ;    Cookies do not respect attributes such as domain, path, expiration, or secure. They <ins class="diffchange diffchange-inline">are </ins>always sent</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Relative redirects don't work, only absolute</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Relative redirects don't work, only absolute</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Redirects from insecure to secure links when you don't have SSL will not be handled well</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Redirects from insecure to secure links when you don't have SSL will not be handled well</div></td></tr>
</table>
Aca20031
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6153&oldid=prev
Aca20031: POST, should pick it up from the external name not the internal name
2015-06-10T17:17:15Z
<p>POST, should pick it up from the external name not the internal name</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 17:17, 10 June 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l165" >Line 165:</td>
<td colspan="2" class="diff-lineno">Line 165:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .hdel %inname chunkleft</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .hdel %inname chunkleft</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Get POST binvar</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Get POST binvar</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>   var %postBV = $http.postdata(%<del class="diffchange diffchange-inline">inname</del>)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>   var %postBV = $http.postdata(%<ins class="diffchange diffchange-inline">exname</ins>)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Use GET if there's no post data, POST otherwise</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Use GET if there's no post data, POST otherwise</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if ($bvar(%postBV,0) == 0) {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if ($bvar(%postBV,0) == 0) {</div></td></tr>
</table>
Aca20031
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6152&oldid=prev
Aca20031: +http.close to example
2015-05-22T19:46:53Z
<p>+http.close to example</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 19:46, 22 May 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l15" >Line 15:</td>
<td colspan="2" class="diff-lineno">Line 15:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  on *:SIGNAL:http: {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  on *:SIGNAL:http: {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if ($1 == google) {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if ($1 == google) {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>       if ($2 == SAVED) { run $3- }  </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>       if ($2 == SAVED) { run $3- <ins class="diffchange diffchange-inline">| http.close $1 </ins>}  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>       if ($2 == PROGRESS) { echo -atg Download progress: $bytes($3).suf $+ / $+ $bytes($4).suf downloaded }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>       if ($2 == PROGRESS) { echo -atg Download progress: $bytes($3).suf $+ / $+ $bytes($4).suf downloaded }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td></tr>
</table>
Aca20031
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6143&oldid=prev
Aca20031: pathIndex should be a local variable
2015-04-02T16:19:48Z
<p>pathIndex should be a local variable</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 16:19, 2 April 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l602" >Line 602:</td>
<td colspan="2" class="diff-lineno">Line 602:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %port</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %port</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %path</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %path</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  var %pathIndex</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %protocol</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %protocol</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %regex = /^(https?://)?([a-z.0-9\-_]+)(:\d+)?(/.*)?$/i</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %regex = /^(https?://)?([a-z.0-9\-_]+)(:\d+)?(/.*)?$/i</div></td></tr>
</table>
Aca20031
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6141&oldid=prev
Jay2k1: /* Script */ bugfix in http.urlparse: local var %protocol wasn't initialized, so %protocol was set as global variable, which led to an empty %host variable if you passed an url without protocol as argument to http.urlparse, which made sockopen fail
2015-02-22T04:28:24Z
<p><span dir="auto"><span class="autocomment">Script: </span> bugfix in http.urlparse: local var %protocol wasn't initialized, so %protocol was set as global variable, which led to an empty %host variable if you passed an url without protocol as argument to http.urlparse, which made sockopen fail</span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 04:28, 22 February 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l602" >Line 602:</td>
<td colspan="2" class="diff-lineno">Line 602:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %port</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %port</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %path</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %path</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  var %protocol</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %regex = /^(https?://)?([a-z.0-9\-_]+)(:\d+)?(/.*)?$/i</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %regex = /^(https?://)?([a-z.0-9\-_]+)(:\d+)?(/.*)?$/i</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if ($regex($1, %regex)) {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if ($regex($1, %regex)) {</div></td></tr>
</table>
Jay2k1
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6140&oldid=prev
Aca20031: - Extra space
2015-02-22T01:17:18Z
<p>- Extra space</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 01:17, 22 February 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l21" >Line 21:</td>
<td colspan="2" class="diff-lineno">Line 21:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Script ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Script ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">  </del>; Ben's (ben@st0rm.net) HTTP for mIRC script (mHTTP)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"> </ins>; Ben's (ben@st0rm.net) HTTP for mIRC script (mHTTP)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Used to download over HTTP</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Used to download over HTTP</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Basic usage</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Basic usage</div></td></tr>
</table>
Aca20031
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6139&oldid=prev
Aca20031: http.mark
2015-02-22T01:15:43Z
<p>http.mark</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 01:15, 22 February 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l21" >Line 21:</td>
<td colspan="2" class="diff-lineno">Line 21:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Script ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Script ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline"> </del>; Ben's (ben@st0rm.net) HTTP for mIRC script (mHTTP)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  </ins>; Ben's (ben@st0rm.net) HTTP for mIRC script (mHTTP)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Used to download over HTTP</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Used to download over HTTP</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Basic usage</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Basic usage</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l42" >Line 42:</td>
<td colspan="2" class="diff-lineno">Line 42:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; After a request completes (e.g. after a save) you can get some data:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; After a request completes (e.g. after a save) you can get some data:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    $http.responseheader(handle, header, N) - Returns value of given responseheader, or $false. Only useful after a request is made</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    $http.responseheader(handle, header, N) - Returns value of given responseheader, or $false. Only useful after a request is made</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> ;</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> ; You can mark a socket with data of your choice (it's a transparent write to a hashtable) similar to sockmark</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> ; /http.mark <handle> [data] - Writes the data. Specify no data to delete the mark</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> ; $http.mark(handle) - Reads the data</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Signals</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Signals</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l105" >Line 105:</td>
<td colspan="2" class="diff-lineno">Line 109:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Start socket</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Start socket</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   http.sockstart %hashtable</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   http.sockstart %hashtable</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> }</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"> alias http.mark {</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  var %hashtable = http. $+ $1</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  if ($isid) {</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    ; As an identifier, read the mark</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    return $hget(%hashtable,mark)</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  }</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  else {</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    ; As a command, set the mark</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    if (!$hget(%hashtable)) {</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      echo -atg * /http.mark - No such handle $1</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    }</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    elseif (!$2) { </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      .hdel %hashtable mark</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    }</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    else {</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      .hadd %hashtable mark $2-</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    }</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  }</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Opens socket</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Opens socket</div></td></tr>
</table>
Aca20031
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6138&oldid=prev
Aca20031: + http.save to &bvar
2015-02-22T00:44:05Z
<p>+ http.save to &bvar</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 00:44, 22 February 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l21" >Line 21:</td>
<td colspan="2" class="diff-lineno">Line 21:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Script ==</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>== Script ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">  </del>; Ben's (ben@st0rm.net) HTTP for mIRC script (mHTTP)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"> </ins>; Ben's (ben@st0rm.net) HTTP for mIRC script (mHTTP)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Used to download over HTTP</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Used to download over HTTP</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Basic usage</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Basic usage</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; /http.open [name] <URL>  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; /http.open [name] <URL>  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Opens an HTTP handle for the given URL</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Opens an HTTP handle for the given URL</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>  ; /http.save [-f] <name> <file></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>  ; /http.save [-f] <name> <file<ins class="diffchange diffchange-inline">|bvar</ins>></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>  ;    Downloads <del class="diffchange diffchange-inline">the </del>HTTP resource to the given file</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>  ;    Downloads <ins class="diffchange diffchange-inline">a given </ins>HTTP resource to the given file <ins class="diffchange diffchange-inline">or binvar</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    -f forces the file to be overwritten</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    -f forces the file to be overwritten</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; /http.close <name>  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; /http.close <name>  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Closes and HTTP handle for the given URL</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;    Closes and HTTP handle for the given URL</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>  ; Here are some things you can do after opening a handle, but before saving<del class="diffchange diffchange-inline">/downloading </del>it <del class="diffchange diffchange-inline">as a file</del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>  ; Here are some things you can do after opening a handle, but before saving it</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Manage POST data:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ; Manage POST data:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;  /http.addpost <handle> <variable> <value></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  ;  /http.addpost <handle> <variable> <value></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l78" >Line 78:</td>
<td colspan="2" class="diff-lineno">Line 78:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     return</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     return</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>   var %<del class="diffchange diffchange-inline">file </del>= $2-</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>   var %<ins class="diffchange diffchange-inline">destination </ins>= $2-</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>   if ($exists(%<del class="diffchange diffchange-inline">file</del>)) {</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>   if ($exists(%<ins class="diffchange diffchange-inline">destination</ins>)) {</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     if (%force) {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     if (%force) {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>       .remove %<del class="diffchange diffchange-inline">file</del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>       .remove %<ins class="diffchange diffchange-inline">destination</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     else {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     else {</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l88" >Line 88:</td>
<td colspan="2" class="diff-lineno">Line 88:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>   ;  Open file handler stream for writing</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>   <ins class="diffchange diffchange-inline">if (&* iswm %destination) { </ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">  </del>.fopen -n %hashtable %<del class="diffchange diffchange-inline">file</del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    .hadd %hashtable bvarout %destination</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">  </del>if ($ferr) {</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  }</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">    </del>echo -atg * /http.save: Could not use file. Error: $ferr</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  else {</ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>     <del class="diffchange diffchange-inline">return</del></div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    </ins>;  Open file handler stream for writing</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    </ins>.fopen -n %hashtable %<ins class="diffchange diffchange-inline">destination</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    </ins>if ($ferr) {</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">      </ins>echo -atg * /http.save: Could not use file. Error: $ferr</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">      return</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    }</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">    ; Store fstream name in hashtable to indicate that we want to save this once it completes</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>     <ins class="diffchange diffchange-inline">.hadd %hashtable fstream %hashtable</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">  ; Store fstream name in hashtable to indicate that we want to save this once it completes</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;">  .hadd %hashtable fstream %hashtable</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Set redirect counter to 0</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Set redirect counter to 0</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .hadd %hashtable redirects 0</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .hadd %hashtable redirects 0</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l425" >Line 425:</td>
<td colspan="2" class="diff-lineno">Line 430:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %table = http. $+ $1</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %table = http. $+ $1</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if (!$hget(%table,responseheaders)) { return $false }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if (!$hget(%table,responseheaders)) { return $false }</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>   noop $hget(%table,responseheaders, &bvResponseHeaders)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>   noop $hget(%table,responseheaders, &bvResponseHeaders<ins class="diffchange diffchange-inline">)</ins>)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Set up parameters for the header search</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Set up parameters for the header search</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Offset is where we start searching from in the loop</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Offset is where we start searching from in the loop</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l478" >Line 478:</td>
<td colspan="2" class="diff-lineno">Line 483:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .hadd $1 redirects 0</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .hadd $1 redirects 0</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .signal HTTP $right($1,-5) COMPLETED $hget($1,responsestatus)</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   .signal HTTP $right($1,-5) COMPLETED $hget($1,responsestatus)</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  if ($hget($1, bvarout)) {</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    noop $hget($1,body,&bvBody)</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    var %bvarout = $ifmatch</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    bcopy %bvarout 1 &bvBody 1 -1</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    ; Need to use -n so that the binvar is still in scope</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    ; So we need to do this last</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    .signal -n http $right($1,-5) SAVED %bvarout</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  }</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  alias http.open {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>  alias http.open {</div></td></tr>
</table>
Aca20031
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6120&oldid=prev
Cail: Removed an extra ).
2014-11-16T10:26:11Z
<p>Removed an extra ).</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='en'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 10:26, 16 November 2014</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l425" >Line 425:</td>
<td colspan="2" class="diff-lineno">Line 425:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %table = http. $+ $1</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   var %table = http. $+ $1</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if (!$hget(%table,responseheaders)) { return $false }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   if (!$hget(%table,responseheaders)) { return $false }</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>   noop $hget(%table,responseheaders, &bvResponseHeaders<del class="diffchange diffchange-inline">)</del>)</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>   noop $hget(%table,responseheaders, &bvResponseHeaders)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Set up parameters for the header search</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Set up parameters for the header search</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Offset is where we start searching from in the loop</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   ; Offset is where we start searching from in the loop</div></td></tr>
</table>
Cail
https://script.quakenet.org/wiki/index.php?title=MHTTP&diff=6119&oldid=prev
Aca20031: Created page with "Often times you may want to download a web page from the internet using HTTP, but HTTP can be complicated. This script handles most of the basics for you including * URL Pars..."
2014-11-11T01:44:15Z
<p>Created page with "Often times you may want to download a web page from the internet using HTTP, but HTTP can be complicated. This script handles most of the basics for you including * URL Pars..."</p>
<p><b>New page</b></p><div>Often times you may want to download a web page from the internet using HTTP, but HTTP can be complicated. This script handles most of the basics for you including<br />
* URL Parsing<br />
* SSL <br />
* Cookies<br />
* Sending POST data<br />
* Following redirects<br />
* Handling CHUNKED encoding<br />
<br />
Typical usage simply involves using the /http.open, save and close commands to download a file, and creating a signal event to do something with it once it is done.<br />
== Example ==<br />
alias DownloadGooglesLogo {<br />
http.open google https://www.google.com/images/srpr/logo11w.png<br />
http.save -f google logo.png<br />
}<br />
on *:SIGNAL:http: {<br />
if ($1 == google) {<br />
if ($2 == SAVED) { run $3- } <br />
if ($2 == PROGRESS) { echo -atg Download progress: $bytes($3).suf $+ / $+ $bytes($4).suf downloaded }<br />
}<br />
}<br />
<br />
== Script ==<br />
; Ben's (ben@st0rm.net) HTTP for mIRC script (mHTTP)<br />
; Used to download over HTTP<br />
; Basic usage<br />
; /http.open [name] <URL> <br />
; Opens an HTTP handle for the given URL<br />
; /http.save [-f] <name> <file><br />
; Downloads the HTTP resource to the given file<br />
; -f forces the file to be overwritten<br />
; /http.close <name> <br />
; Closes and HTTP handle for the given URL<br />
;<br />
; Here are some things you can do after opening a handle, but before saving/downloading it as a file<br />
; Manage POST data:<br />
; /http.addpost <handle> <variable> <value><br />
; /http.delpost <handle> <variable><br />
; Manage cookies <br />
; /http.addcookie <handle> <value><br />
; $http.cookie(handle,N) - gets Nth cookie<br />
;<br />
; After a request completes (e.g. after a save) you can get some data:<br />
; $http.responseheader(handle, header, N) - Returns value of given responseheader, or $false. Only useful after a request is made<br />
;<br />
; Signals<br />
; In order to tell via script when something happens (your file is being saved, for example) use<br />
; on *:SIGNAL:http:<br />
; where $1 = Handle name, $2 = Event name, $3- = parameters<br />
; Events:<br />
; COMPLETED <statuscode> - when a request completes<br />
; SAVED <location> - when a save completes<br />
; REDIRECT <location> - when a request is redirected elsewhere <br />
; PROGRESS <bytes> [total size] - When part but not all of the data is downloaded. Total size is not available for chunked transfer<br />
; <br />
;<br />
; Known issues:<br />
; Cookies do not respect attributes such as domain, path, expiration, or secure. They area always sent<br />
; Relative redirects don't work, only absolute<br />
; Redirects from insecure to secure links when you don't have SSL will not be handled well<br />
; Creates a request that when completed is saved to a file<br />
alias http.save {<br />
if ($1 == -f) {<br />
var %force = $true<br />
tokenize 32 $2-<br />
}<br />
else { var %force = $false }<br />
if ($0 < 2) { <br />
echo -atg * /http.save: Use /http.save <http handle> <file><br />
return<br />
}<br />
var %hashtable = http. $+ $1<br />
if (!$hget(%hashtable)) { <br />
echo -atg * /http.save: No such HTTP handle exists. Use /http.open first<br />
return<br />
}<br />
if ($sock(%hashtable)) {<br />
echo -atg * /http.save: There is a pending request for this HTTP handle already. A connection is open the the remote host. Close it, or wait for it to complete <br />
return<br />
}<br />
var %file = $2-<br />
if ($exists(%file)) {<br />
if (%force) {<br />
.remove %file<br />
}<br />
else {<br />
echo -atg * /http.save: File already exists. Try /http.save -f to force an overwrite<br />
return<br />
}<br />
}<br />
; Open file handler stream for writing<br />
.fopen -n %hashtable %file<br />
if ($ferr) {<br />
echo -atg * /http.save: Could not use file. Error: $ferr<br />
return<br />
}<br />
; Store fstream name in hashtable to indicate that we want to save this once it completes<br />
.hadd %hashtable fstream %hashtable<br />
; Set redirect counter to 0<br />
.hadd %hashtable redirects 0<br />
; Start socket<br />
http.sockstart %hashtable<br />
}<br />
; Opens socket<br />
alias -l http.sockstart {<br />
if ($hget($1,secure) == $true) {<br />
if ($sock($1) && $sock($1).ssl) { <br />
http.sendrequest $1<br />
} <br />
else {<br />
if ($sock($1)) { .sockclose $1 }<br />
if (!$sslready) {<br />
echo -atg HTTP Error - request $qt($right($1,-5)) would require you to use SSL but you are not SSL ready. Please see http://mirc.com/ssl.html<br />
http.close $right($1,-5)<br />
return<br />
}<br />
sockopen -e $1 $hget($1, host) $hget($1, port)<br />
}<br />
}<br />
else {<br />
if ($sock($1)) {<br />
http.sendrequest $1<br />
}<br />
else {<br />
sockopen $1 $hget($1, host) $hget($1, port)<br />
}<br />
}<br />
}<br />
; Sends the request. Assumes the socket is open and ready<br />
alias -l http.sendrequest {<br />
if (!$sock($1)) { echo -atg HTTP Internal error. Socket not open in /http.sendrequest | return }<br />
var %inname = $1<br />
var %exname = $right($1,-5)<br />
; Cleanup from previous requests<br />
.hdel %inname responseheaders<br />
.hdel %inname body<br />
.hdel %inname contentlength<br />
.hdel %inname chunkleft<br />
; Get POST binvar<br />
var %postBV = $http.postdata(%inname)<br />
; Use GET if there's no post data, POST otherwise<br />
if ($bvar(%postBV,0) == 0) {<br />
sockwrite -n %inname GET $hget(%inname,path) HTTP/1.1 <br />
}<br />
else {<br />
sockwrite -n %inname POST $hget(%inname,path) HTTP/1.1 <br />
}<br />
; Send the host<br />
sockwrite -n %inname Host: $hget(%inname,host)<br />
; Send the user-agent<br />
sockwrite -n %inname User-agent: $hget(%inname,user-agent)<br />
sockwrite -n %inname Connection: Keep-Alive<br />
; Only plain-text supported<br />
sockwrite -n %inname Accept: text/plain; q=0.5, text/html<br />
; Send cookies<br />
if ($http.cookie(%exname, 0) > 0) {<br />
sockwrite %inname Cookie: $+ $chr(32)<br />
var %i = 1<br />
while ($http.cookie(%exname, %i)) {<br />
sockwrite %inname $http.urlencode($ifmatch) $+ ;<br />
inc %i<br />
}<br />
sockwrite -n %inname<br />
}<br />
; If POST send content type and length<br />
if ($bvar(%postBV,0) > 0) {<br />
sockwrite -n %inname Content-Type: application/x-www-form-urlencoded<br />
sockwrite -n %inname Content-Length: $v1<br />
}<br />
; End request headers with empty line<br />
sockwrite -n %inname<br />
; If POST, send data<br />
if ($bvar(%postBV,0) > 0) {<br />
sockwrite %inname %postBV<br />
; sockwrite -n %inname<br />
}<br />
}<br />
; Just some bookeeping in case we miss it <br />
on *:SOCKCLOSE:http.*: {<br />
if ($fopen($sockname)) { .fclose $sockname }<br />
}<br />
on *:SOCKOPEN:http.*: {<br />
http.sendrequest $sockname<br />
}<br />
on *:SOCKREAD:http.*: {<br />
if ($sockerr > 0) {<br />
echo -atg * HTTP handle $qt($right($sockname,-5)) failed with socket error $sockerr<br />
http.close $right($sockname,-5)<br />
return<br />
}<br />
;Read all the data into &bvTemp<br />
:read<br />
; First, read this buffer<br />
sockread &bvThis<br />
if ($sockbr > 0) {<br />
; If data was read, copy it to the on-going buffer and continue<br />
bcopy &bvTemp $calc($bvar(&bvTemp,0) +1) &bvThis 1 -1<br />
goto read<br />
}<br />
if ($bvar(&bvTemp,0) == 0) { echo -atg HTTP sockread called with no data to read... | return }<br />
; Do we need to parse headers?<br />
; If response headers not set, this call has the headers<br />
if (!$hget($sockname,responseheaders)) {<br />
; Find the response headers<br />
var %end = $bfind(&bvTemp,1, 13 10 13 10)<br />
if (%end == 0) { echo -atg Error: No headers found, but no content length so this can't be a subsequent call | return }<br />
; Increase to include the 3 extra characters<br />
inc %end 3<br />
bcopy &bvResponseHeaders 1 &bvTemp 1 %end<br />
; If there's still non-header data copy it over<br />
if (%end < $bvar(&bvTemp, 0)) { <br />
bcopy -c &bvTemp 1 &bvTemp $calc(%end + 1) -1<br />
}<br />
else { bunset &bvTemp }<br />
; If this is the first header response, save in hash table<br />
if (!$hget($sockname, responseheaders)) {<br />
.hadd -b $sockname responseheaders &bvResponseHeaders <br />
http.OnHeaders $sockname<br />
}<br />
}<br />
; there's no more to read, bail<br />
if (!$bvar(&bvTemp,0)) {<br />
; If that's all this response has to offer, we're done<br />
if ($hget($sockname,contentlength) == 0) {<br />
http.ondone $sockname<br />
}<br />
return<br />
}<br />
; Read body<br />
var %contentlength = $hget($sockname,contentlength)<br />
if (%contentlength == $null || %contentlength == $false) {<br />
var %chunked = $true<br />
}<br />
else {<br />
var %chunked = $false<br />
}<br />
; Set bvBody to the body ready so far<br />
if ($hget($sockname,body)) {<br />
noop $hget($sockname, body, &bvBody)<br />
}<br />
if (%chunked) {<br />
:readChunk<br />
var %chunkleft = $hget($sockname, chunkleft)<br />
if (!%chunkleft) {<br />
; If we've read all of a chunk, or this is the first one, get its size<br />
var %crlf = $bfind(&bvTemp, 1, 13 10)<br />
if (!%crlf) {<br />
echo -atg HTTP internal error. Handle $qt($right($sockname,-5)) is in chunked encoding but no chunk size found in data<br />
return<br />
}<br />
var %chunkleft = $base($bvar(&bvTemp, 1, $calc(%crlf - 1)).text,16,10)<br />
if (%chunkleft !isnum) {<br />
echo -atg HTTP internal error. Handle $qt($right($sockname,-5)) has invalid chunk size: %chunkleft<br />
}<br />
; New chunk<br />
else {<br />
; Save chunk size and remove it (plus its \r\n) from temp<br />
.hadd $sockname chunkleft %chunkleft<br />
.bcopy -c &bvTemp 1 &bvTemp $calc(%crlf +2) -1<br />
if (%chunkLeft == 0) { <br />
; if we just read chunk size 0, that was the end. <br />
.hadd -b $sockname body &bvBody<br />
http.onDone $sockname<br />
return<br />
}<br />
}<br />
}<br />
; read %chunkleft bytes<br />
var %bytesToRead = $iif(%chunkLeft < $bvar(&bvTemp,0),%chunkLeft, $bvar(&bvTemp,0))<br />
.bcopy &bvBody $calc($bvar(&bvBody,0) +1) &bvTemp 1 %bytesToRead<br />
hdec $sockname chunkleft %bytesToRead<br />
.signal http $right($sockname,-5) PROGRESS %bytesToRead<br />
if (%bytesToRead == %chunkLeft) {<br />
; If this is the end of the chunk, consume crlf<br />
inc %bytesToRead 2<br />
; If there's still stuff in this var, go back and read the new chunk<br />
if (%bytesToRead < $bvar(&bvTemp,0)) {<br />
.bcopy -c &bvTemp 1 &bvTemp $calc(%bytesToRead + 1) -1 <br />
goto readChunk<br />
}<br />
}<br />
; End of this call, save body in hashtable for future calls<br />
.hadd -b $sockname body &bvBody<br />
}<br />
else {<br />
; Copy everything<br />
.bcopy &bvBody $calc($bvar(&bvBody,0) +1) &bvTemp 1 -1<br />
; Add read-so-far body to hashtable<br />
.hadd -b $sockname body &bvBody<br />
.signal http $right($sockname,-5) PROGRESS $bvar(&bvBody,0) $hget($sockname,contentlength) <br />
; Check if we're done<br />
if ($bvar(&bvBody,0) >= $hget($sockname,contentlength)) { <br />
; We're done<br />
http.onDone $sockname<br />
if ($bvar(&bvBody,0) > $hget($sockname,contentlength)) { <br />
echo -qatg HTTP Warning: Read past content-length.<br />
}<br />
}<br />
}<br />
}<br />
; Internal event called when we get the first header response from the server<br />
alias -l http.OnHeaders {<br />
noop $hget($1,responseheaders, &bvResponseHeaders)<br />
; First header is always the status response<br />
var %end = $bfind(&bvResponseHeaders, 1, 13 10)<br />
if (%end <= 1) {<br />
echo -atg Error: HTTP $qt($right($1,-5)) Server did not respond with HTTP status <br />
goto cleanup<br />
}<br />
var %status = $bvar(&bvResponseHeaders,1,$calc(%end - 1)).text<br />
.hadd $1 responsestatus %status<br />
var %version = $gettok(%status,1,32)<br />
if (%version != HTTP/1.1 && %version != HTTP/1.0) {<br />
echo -atg Error: HTTP $qt($right($1,-5)) Server indicated unknown version: %version<br />
goto cleanup<br />
}<br />
var %statuscode = $gettok(%status,2,32)<br />
if (%statuscode !isnum) {<br />
echo -atg Error: HTTP $qt($right($1,-5)) Server indicated invalid status code: %statuscode<br />
goto cleanup<br />
}<br />
; Check transfer type<br />
if ($http.responseheader($right($1,-5),Content-Length,1) != $null) {<br />
hadd $1 contentlength $v1<br />
}<br />
elseif ($http.responseheader($right($1,-5), Transfer-Encoding, 1) != chunked) {<br />
echo -atg HTTP Handle $qt($right($1,-5)) has no content-length header and is not chunked<br />
echo -atg $bvar(&bvResponseHeaders,1-).text<br />
return<br />
} <br />
; Add any cookies that were set<br />
var %cookie = 1<br />
while ($http.responseheader($right($1,-5), Set-Cookie, %cookie)) {<br />
inc %cookie<br />
var %cookieValue = $gettok($ifmatch,1,$asc(;))<br />
http.addcookie $right($1,-5) %cookieValue<br />
}<br />
; Handle redirects<br />
if (%statuscode == 303 || %statuscode == 302 || %statuscode == 307) {<br />
var %location = $http.responseheader($right($1,-5), Location)<br />
.signal http $right($1,-5) REDIRECT %location<br />
http.seturl $1 %location<br />
hinc $1 redirects<br />
; If the server doesn't promise us this connection is keep-alive, close it and use a new one<br />
if ($http.responseheader($right($1,-5), Connection, 1) != Keep-Alive) {<br />
if ($sock($1)) { .sockclose $1 }<br />
}<br />
if ($hget($1, redirects) > 5) {<br />
echo -atg HTTP Handle $qt($right($1,-5)) redirect loop detected<br />
return<br />
}<br />
http.sockstart $1<br />
}<br />
return<br />
:cleanup<br />
if ($sock($1)) { .sockclose $1 }<br />
}<br />
alias http.addcookie {<br />
var %hashtable = http. $+ $1<br />
if (!$hget(%hashtable)) {<br />
echo -atg * /http.addcookie: No such HTTP handle<br />
return<br />
}<br />
if ($0 < 2) {<br />
echo -atg * /http.addcookie: Usage: /http.addcookie <handle> <value><br />
return<br />
}<br />
var %i = 1<br />
var %cookieNum = 1<br />
while ($hget(%hashtable,%i).item) {<br />
var %item = $ifmatch<br />
inc %i<br />
if (cookie-* iswm %item) {<br />
var %tmp = $gettok(%item,2,$asc(-))<br />
; If the value is the same, overwrite<br />
if ($2- == $hget(%hashtable,%item)) {<br />
%cookieNum = %tmp<br />
break<br />
}<br />
; Otherwise store max cookie num<br />
elseif (%tmp >= %cookieNum) { %cookieNum = $calc(%tmp + 1) }<br />
}<br />
}<br />
.hadd %hashtable cookie- $+ %cookieNum $+ -value $2-<br />
}<br />
; Gets an HTTP cookie for the given handle<br />
; $http.cookie(<handle>, <index>)<br />
alias http.cookie {<br />
if ($2 !isnum) {<br />
echo -atg * $!http.cookie invalid parameters<br />
return<br />
}<br />
var %hashtable = http. $+ $1<br />
if (!$hget(%hashtable)) {<br />
echo -atg * $!http.cookie no such HTTP handle <br />
return<br />
}<br />
var %i = 1<br />
var %found = 0<br />
while ($hget(%hashtable, %i).item) {<br />
inc %i<br />
var %item = $ifmatch<br />
if (cookie-*-value iswm %item) {<br />
inc %found<br />
var %id = $gettok(%item,2,$asc(-))<br />
if (%found == $2) {<br />
return $hget(%hashtable, cookie- $+ %id $+ -value)<br />
}<br />
}<br />
}<br />
if ($2 == 0) { return %found }<br />
}<br />
; Returns the value of the given response header<br />
; Case sensitive since it is binary variable operation<br />
alias http.responseheader {<br />
if ($0 < 2) {<br />
echo -atg Invalid usage. Use: $http.responseheader(<handle>, <header>[, index])<br />
return<br />
}<br />
; %index is parameter 3 - 1-N or 0 for number<br />
var %index = 1<br />
if ($3 isnum) {<br />
%index = $3<br />
}<br />
; Veriy hash table exists<br />
var %table = http. $+ $1<br />
if (!$hget(%table,responseheaders)) { return $false }<br />
noop $hget(%table,responseheaders, &bvResponseHeaders))<br />
; Set up parameters for the header search<br />
; Offset is where we start searching from in the loop<br />
; thisIndex is the number of matches found so far<br />
var %offset = 1<br />
var %thisIndex = 0<br />
; The main search loop<br />
:search<br />
var %start = $bfind(&bvResponseHeaders, %offset, $2 $+ :).text<br />
; If there isn't another match, either the index was too large or they want the count<br />
if (!%start) { <br />
if (%index == 0) { return %thisIndex }<br />
else { return $false }<br />
}<br />
; Find the end of the header<br />
var %end = $bfind(&bvResponseHeaders, %start, 13 10)<br />
if (%end <= %start) { echo -atg HTTP Internal error ($http.responseheader), header $qt($2) for handle $qt($1) has no CRLF termination | return $false }<br />
inc %thisIndex<br />
; If this not the one they asked for, try again starting from the end of this header<br />
if (%index != %thisIndex) {<br />
var %offset = %end<br />
goto search<br />
}<br />
; Find the colon. If there isn't one we'll return the whole string<br />
if ($calc($bfind(&bvResponseHeaders, %start, $asc(:)) +1) < %end) {<br />
%start = $v1<br />
}<br />
return $bvar(&bvResponseHeaders,%start, $calc(%end - %start)).text<br />
}<br />
; Internal event called when a request is filled. $1 = internal handle name<br />
alias -l http.onDone {<br />
if ($hget($1,responseheaders)) {<br />
noop $hget($1,responseheaders,&bvResponseHeaders)<br />
}<br />
; Write out and close filestream if set<br />
if ($hget($1,fstream)) {<br />
noop $hget($1,body,&bvBody)<br />
if (!$bvar(&bvBody,0)) {<br />
.fclose $hget($1,fstream)<br />
}<br />
else {<br />
.fwrite -b $hget($1,fstream) &bvBody<br />
; Save fname so we can use it in the signal after the close<br />
var %fname = $fopen($hget($1,fstream)).fname<br />
.fclose $hget($1,fstream)<br />
.signal http $right($1,-5) SAVED %fname<br />
}<br />
}<br />
; If socket is still around, close it<br />
if ($sock($1)) { .sockclose $1 }<br />
; Reset redirects for future calls<br />
.hadd $1 redirects 0<br />
.signal HTTP $right($1,-5) COMPLETED $hget($1,responsestatus)<br />
}<br />
alias http.open {<br />
var %hashtable<br />
; If two parameters are given, $1 is the name, else create a new name<br />
if ($0 > 1) { %hashtable = http. $+ $1 }<br />
else { <br />
var %h = $calc($ticks % $rand(1,1000000))<br />
var %hashtable = http. $+ %h <br />
}<br />
if ($hget(%hashtable)) {<br />
echo -atg * /http.open: HTTP Request $qt($1) already exists<br />
return<br />
}<br />
; Encode the octects of the URL. e.g.: foo bar,pie --> foo%20bar,%2Cpie<br />
var %url = $iif($0 > 1, $2-, $1-)<br />
var %urlEncoded = $http.urlencode(%url)<br />
; Check the URL<br />
if (!$http.urlparse(%urlEncoded)) {<br />
echo -atg * /http.open: Malformed URL. Use /http.open [name] <url> <br />
return<br />
}<br />
if ($http.urlparse(%urlEncoded).secure && !$sslready) {<br />
echo -atg * /http.open: URL is SSL but $!sslready = false. See http://www.mirc.com/ssl.html<br />
return<br />
}<br />
; Everything checks out, let's store the relevent bits in a hashtable<br />
.hmake %hashtable 10<br />
http.seturl %hashtable %url<br />
echo -qatg * /http.open: Opened HTTP request $qt($right(%hashtable,-5))<br />
}<br />
alias -l http.seturl {<br />
if ($0 < 2) { echo -atg HTTP Internal error, seturl called with no url }<br />
var %hashtable = $1<br />
if (!$hget(%hashtable)) { echo -atg HTTP Internal error, seturl called with invalid handle }<br />
var %urlEncoded = $http.urlencode($2-)<br />
.hadd %hashtable host $http.urlparse(%urlEncoded).host<br />
.hadd %hashtable port $http.urlparse(%urlEncoded).port<br />
.hadd %hashtable secure $http.urlparse(%urlEncoded).secure<br />
.hadd %hashtable path $http.urlparse(%urlEncoded).path<br />
.hadd %hashtable user-agent mIRC $version<br />
}<br />
alias http.list {<br />
var %i = 1<br />
var %numFound = 0<br />
while (%i <= $hget(0)) {<br />
var %table = $hget(%i)<br />
inc %i<br />
if (http.* iswm %table) {<br />
inc %numFound<br />
echo -atg * $right(%table,-5) $+ : Host: $hget(%table,host) Port: $hget(%table,port) Path: $hget(%table,path)<br />
}<br />
}<br />
if (%numFound == 0) { echo -atg * No HTTP handles opened }<br />
}<br />
alias http.close {<br />
var %i = 1<br />
var %numFound = 0<br />
while (%i <= $hget(0)) {<br />
var %table = $hget(%i)<br />
if (http. $+ $1 iswm %table) {<br />
; Cleanup resources<br />
if ($sock(%table)) { .sockclose %table }<br />
if ($fopen(%table)) { .fclose %table }<br />
if ($hget(%table $+ .postdata)) { .hfree %table $+ .postdata }<br />
.hfree %table<br />
inc %numFound<br />
echo -qatg * HTTP Closed $right(%table,-5) <br />
}<br />
; Only inc if we didnt find a match<br />
else {<br />
inc %i<br />
}<br />
}<br />
if (%numFound == 0) { echo -qatg * No matching HTTP handles } <br />
}<br />
;<br />
; Takes an encoded URL and returns based on the property<br />
; .secure - true if https<br />
; .host - the URL host<br />
; .port - the port, 80 by default<br />
; .path - The path to download, / by default<br />
; Returns $false is URL is malformed<br />
;<br />
alias http.urlparse {<br />
var %secure<br />
var %host<br />
var %port<br />
var %path<br />
var %regex = /^(https?://)?([a-z.0-9\-_]+)(:\d+)?(/.*)?$/i<br />
if ($regex($1, %regex)) {<br />
if (http*:// iswm $regml(1)) {<br />
%protocol = $lower($left($regml(1),-3))<br />
}<br />
%secure = $false<br />
if (%protocol == https) { <br />
%secure = $true<br />
}<br />
if (%protocol) { %host = $regml(2) }<br />
else { %host = $regml(1) } <br />
var %portIndex = $iif(%protocol, 3, 2)<br />
var %portfound = $false<br />
if ($left($regml(%portIndex),1) == : && $right($regml(%portIndex),-1) isnum) {<br />
%port = $right($regml(%portIndex),-1) <br />
%portFound = $true<br />
}<br />
else {<br />
if (%secure) { <br />
%port = 443<br />
}<br />
else {<br />
%port = 80<br />
}<br />
}<br />
%pathIndex = $iif(%portFound, $calc(%portIndex + 1), %portIndex)<br />
if ($regml(0) >= %pathIndex) {<br />
%path = $regml(%pathIndex)<br />
}<br />
else { %path = / }<br />
} <br />
else { return $false }<br />
if ($prop == secure) { return %secure }<br />
if ($prop == host) { return %host }<br />
if ($prop == path) { return %path }<br />
if ($prop == port) { return %port }<br />
return $true<br />
}<br />
alias http.addpost {<br />
if ($0 < 3) { <br />
echo -atg * /http.addpost: Usage: /http.addpost <handle> <variable> <value><br />
return<br />
}<br />
var %maintable = http. $+ $1<br />
var %posttable = %maintable $+ .postdata<br />
if (!$hget(%maintable)) {<br />
echo -atg * /http.addpost: No such HTTP handle found<br />
return<br />
}<br />
if (!$hget(%posttable)) { .hmake %posttable 10 }<br />
hadd %posttable $2 $3-<br />
echo -qatg Post variable added: $2 $+ = $+ $3-<br />
}<br />
alias http.delpost {<br />
if ($0 < 2) {<br />
echo -atg * /http.delpost: Usage: /http.delpost <handle> <variable><br />
return<br />
}<br />
var %maintable = http. $+ $1<br />
var %posttable = %maintable $+ .postdata<br />
if (!$hget(%maintable)) {<br />
echo -atg * /http.addpost: No such HTTP handle found<br />
return<br />
}<br />
if (!$hget(%posttable,$2)) {<br />
echo -qatg * /http.addpost: No post variable with that name exists<br />
return<br />
}<br />
hdel %posttable $2<br />
echo -qatg Post variable deleted: $2<br />
}<br />
; Usage: $http.postdata(handle)<br />
; Returns a binvar with a post data style query string (x=y&z=a) or $false<br />
alias http.postdata {<br />
; Post data is stored in INNAME.postdata<br />
var %posttable = http. $+ $1 $+ .postdata<br />
if (!$hget(%posttable,0).item) { return $false }<br />
var %i = 1<br />
while ($hget(%posttable,%i).item) {<br />
var %item = $ifmatch<br />
bset -t &bvPost $calc($bvar(&bvPost,0) +1) $iif(%i > 1,&,) $+ $http.urlencode(%item) $+ = $+ $http.urlencode($hget(%posttable,%item))<br />
inc %i<br />
}<br />
return &bvPost<br />
}<br />
; Replace some commonly touchy URL characters with their hex-octect encoding<br />
alias -l http.urlencode {<br />
return $replacex($1-,$chr(32),% $+ 20, $chr(44), % $+ 2C,+, % $+ 2B, $chr(37), % $+ 25)<br />
}<br />
<br />
{{Author|aca20031}}<br />
<br />
[[Category:Script Archive]]</div>
Aca20031