samp HTTP returns wrong data?
#1

-- DELETED --
Reply
#2

Check the network tab in the developer console in a browser (press F12). The type should be text/plain.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Check the network tab in the developer console in a browser (press F12). The type should be text/plain.
The type is "document". How can I change it to text/plain?
Reply
#4

You're probably looking in the wrong column because there's no MIME type "document". If it's a plain old .txt file then the web server should theoretically already have marked it as text/plain.

Some cheapo free hosting services do inject Javascript into pages which may be problematic. Check the source (CTRL-U) to see what is actually being output.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
You're probably looking in the wrong column because there's no MIME type "document". If it's a plain old .txt file then the web server should theoretically already have marked it as text/plain.

Some cheapo free hosting services do inject Javascript into pages which may be problematic. Check the source (CTRL-U) to see what is actually being output.
This is the console: https://gyazo.com/5ae511e50cb3f6c4decd723d8296b23a
And this is the source: https://gyazo.com/bedad8e35e8b55c2b7e2bbb61733d2ee
Reply
#6

That's still not showing me the actual content-type, which should be in the form type/subtype. Output looks clean, though, so I don't really know what the problem might be. What you can still try is renaming the document to .php and then adding these lines on top:
PHP код:
<?php 
    header
('Content-Type: text/plain'); 
    
header('Cache-Control: no-transform');
?>
Reply
#7

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
The website is probably behind cloudflare or another reverse proxy which authenticates clients and tries to prevent bots. You really should learn how to make a service2service api. If using cloudflare in default configuration it only allows human2service interactions.

You can also solve this by using the real ip of the webserver and getting the file directly, avoiding CF or any other reverse proxies. If you are on a shared hosting you need to create a static/override DNS entry in your DNS Server (where you host your sa-mp server) which will override the global DNS of your server machine. If you are on a shared server hosting and a shared website hosting, you need to create a subdomain which is not protected by cloudflare but directly uses/points to your webhosting. you then use that domain as an api url where you do only message/request authentication (e.g. checking an api key in a POST variable which you verify in your php script).

If you are using someone else's website files on your server, ask the owner of that website to provide you a service api! There's a reason they're behind cloudflare.
I'm using a free webhost (byethost) and it doesn't use cloudflare.
Reply
#8

Quote:
Originally Posted by Vince
Посмотреть сообщение
That's still not showing me the actual content-type, which should be in the form type/subtype. Output looks clean, though, so I don't really know what the problem might be. What you can still try is renaming the document to .php and then adding these lines on top:
PHP код:
<?php 
    header
('Content-Type: text/plain'); 
    
header('Cache-Control: no-transform');
?>
Tried it.. But no luck sadly..
Reply
#9

A 301 is a permanent redirect. It's not an error. As long as it's not in the 400 or 500 range (client error and server error, respectively) you should be fine.
Reply
#10

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
Then do what vice said with a web browser, without an ad blocker. Or just use internet explorerexploder...

Edit: I tried registering a test domain there but it said
Код:
The password entered contains invalid characters.
so fuck that website.. I won't touch it anymore. They probably store the password in plain text in a database.

If its a free website then I'm sure they're injecting ads, just as Vice said.
Quote:
Originally Posted by Vince
Посмотреть сообщение
A 301 is a permanent redirect. It's not an error. As long as it's not in the 400 or 500 range (client error and server error, respectively) you should be fine.
Apparently the javascript thing I'm getting is:

Код:
<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("32dd5dce2bb59e5034a37a97be5c36e5");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://www.thelegendspanel.ga/api.txt?i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>
So it says that it needs javascript.. Lol.
"his site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support"
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)