Jump to content




[NEED A PATCH] My program downloads hosting's 404 page when i try to download non-existent files


  • You cannot reply to this topic
6 replies to this topic

#1 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 18 September 2014 - 06:56 PM

The title explains. When I Try to download nonexistent files, my program downloads 404 page of free hosting.

I TRIED patching. But it doesn't work

Here's my patch
--hostingnamehere 404 patcher START
  local patch = http.get("404 url here")
  if pInfo.readAll() == patch.readAll() then
	error("nil")
  else
  --hostingnamehere 404 patcher END

Note: pInfo is the thing my program downloads.
Note 2: Theres code down below else. So dont worry about it.
Note 3: I use error("nil") because i set the program so it makes a message about nil errors

#2 Win7yes

  • Members
  • 110 posts

Posted 18 September 2014 - 07:28 PM

Well, they are nonexistent. And all nonexistent stuff in the Internet gets redirected to the host's 404 page. So, trying to download a non existing file will redirect the URL request to the 404 page, meaning that will be the thing that will be downloaded.
Resuming the stuff in simpler words: Do not download non existing files.

#3 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 18 September 2014 - 07:49 PM

View PostWin7yes, on 18 September 2014 - 07:28 PM, said:

Well, they are nonexistent. And all nonexistent stuff in the Internet gets redirected to the host's 404 page. So, trying to download a non existing file will redirect the URL request to the 404 page, meaning that will be the thing that will be downloaded.
Resuming the stuff in simpler words: Do not download non existing files.
Im making a downloader. I dont wanna install nonexistent stuff. But if others want to do. I need something like this or people will get html files on their computer

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 18 September 2014 - 07:53 PM

If HTML files are the problem, couldn't you just check for "<html>" within the string?

#5 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 18 September 2014 - 08:03 PM

View PostKingofGamesYami, on 18 September 2014 - 07:53 PM, said:

If HTML files are the problem, couldn't you just check for "<html>" within the string?
OMG why i did not try that! I'll try it next day after school thx

#6 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 18 September 2014 - 08:06 PM

You can actually check the http response code with ComputerCraft. Take a look at the HTTP API on the wiki for more details.

#7 Admicos

  • Members
  • 207 posts
  • LocationTurkey

Posted 19 September 2014 - 09:23 AM

View PostAdmicos, on 18 September 2014 - 08:03 PM, said:

View PostKingofGamesYami, on 18 September 2014 - 07:53 PM, said:

If HTML files are the problem, couldn't you just check for "<html>" within the string?
OMG why i did not try that! I'll try it next day after school thx
That worked.

View PostCranium, on 18 September 2014 - 08:06 PM, said:

You can actually check the http response code with ComputerCraft. Take a look at the HTTP API on the wiki for more details.
Thanks for that. Maybe ill use it later :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users