📜 ⬆️ ⬇️

How to stop noticing the limited traffic with free WiFi

Good afternoon, dear habrazhiteli!
This post, combined with the question, is devoted to trying to make working with free WiFi convenient.


The post is written about a certain network, but with a simple finish, it will fit almost everyone. In order to avoid curses, I will say that in JS I do not understand almost anything.

Prehistory

As you know, it is now very common in coffee shops, shopping centers, etc. free wifi Most of them have similar methods of work, but here I will talk about one particular place. There the work goes inside a session of 30 minutes and ~ 50MB in size. If there is no active session, then any attempt to load the external site will automatically redirect to the session registration page (... / status.php). On it, the button “Continue to work in the Internet”, which in turn translates to www. @ CompanyName @ .ru . Moreover, the redirect to this page automatically goes 10 seconds after the download.
As a result, without additional shamanism, downloading a file with a browser> 30MB is a great success;> 50MB is basically impossible. Plus, sometimes the session is terminated in the process of writing the text, and the subsequent redirect forces us to rewrite the text anew, which is sometimes extremely annoying.
')
The problem was solved by writing a simple local html file that reloads every 15 seconds and tries to load something from outside into the iframe.
<BODY> <META HTTP-EQUIV="Refresh" Content="15"> <IFRAME src="http://www.ya.ru" width=1024 height=768 scrolling="auto" frameborder="0" id="ifram">_</IFRAME> </BODY> 

As a result, at the end of the session, a new one was registered within 10 seconds, the number of false redirects dropped to almost zero, and the differences from free Internet from home were reduced only to blocking torrents.

And everything would be fine if one day the provider did not change the rules for registering a session. Previously, the session was registered with any download http :: //.../status.php. Now on this page there is a form with a checkbox and words about the majority. When the checkbox was pressed, instead of the yellow button, we received a gray non-clickable picture, with the button pressed, it was returned. The old file, of course, did not work, registration now passes when you click on the button.
Here is the code responsible for the button.
 <form action="https://.../status" method="POST" name="non_reg"> <input type=hidden name=lang value='ru'> <input type=hidden name=screen value='normal'> <input type="hidden" name=url value=''> <input type="hidden" name="mode" value="partner"> <script> //    checkbox'.  btncontinue_g   btncontinue  . </script> <p><input type="checkbox" onclick="checkSubmitBtn(this.checked)">   18 </p> <img id="btncontinue_g" src="/i/v6/b_continue_g_r.gif" alt="   "/> <input id="btncontinue" style="display:none" type=image src="/i/v6/b_continue_r.gif" alt="   "/> </form> 


Having looked at the code and pressing the button, I found out three news. Good - for registration, you just need to complete the form, which at the same time does not convey the value of the checkbox. Bad - method = "POST", then a simple request ../status.php?mode=partner ... does not prokaktit. And funny - after pressing the button, there are already three redirects, two of which could be eliminated.

Well and, accordingly, the solution: we make the same form with the target in the frame and when we load the page we say confirm (). True, it took me an hour, plus some time I needed two files, but in the end I got
this:
 <HEAD> <script> function refreshIFrame() { document.getElementById("olol").submit(); } </script> <TITLE>Refreshing</TITLE> </HEAD> <BODY onload="{refreshIFrame();}"> <META HTTP-EQUIV="Refresh" Content="15"> text<br> <IFRAME name="ifra" src="" width=100 height=100 scrolling="auto" frameborder="0" id="ifram" onLoad=""></IFRAME><br>text<br> <FORM id="olol" NAME="s" METHOD="post" ACTION=".../status" target="ifra"> <input name="lang" value="ru" type="hidden"> <input name="screen" value="normal" type="hidden"> <input name="url" value="" type="hidden"> <input name="mode" value="partner" type="hidden"> </FORM> </BODY> 


And - voila! - it all worked again.
Well, the question is - is it possible to send a POST request without a form to the server?

Source: https://habr.com/ru/post/181854/


All Articles