Raised This Month: $32 Target: $400
 8% 

[INC] HTTP2


Post New Thread Reply   
 
Thread Tools Display Modes
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 09-08-2013 , 09:49   Re: [INC] HTTP2
Reply With Quote #11

Quote:
Originally Posted by Black Rose View Post
Which version are you using?
I assume you're downloading a lot of files in a loop?
I just downloaded the include file and I download only one file.
__________________
Kia is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-08-2013 , 10:01   Re: [INC] HTTP2
Reply With Quote #12

Is it a reoccuring error? Can you please share a sample code to reproduce the error?
__________________
Black Rose is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 09-08-2013 , 10:03   Re: [INC] HTTP2
Reply With Quote #13

I use this code, the file gets created, but it has no content.

PHP Code:
public GetRepos( )
{
    new 
szConfigDir[256], szFile[256], szRepoDir[256], szRepoRepoDir[256]
    
    
get_configsdir(szConfigDircharsmax(szConfigDir))
    
    
formatex(szRepoDircharsmax(szRepoDir),"%s/xRepo"szConfigDir
    
formatex(szRepoRepoDircharsmax(szRepoRepoDir), "%s/repos"szRepoDir)
    
formatex(szFilecharsmax(szFile),  "%s/repos.cfg"szRepoDir)
    
    if(!
dir_exists(szRepoDir)) 
        
mkdir(szRepoDir)
    
    if(!
dir_exists(szRepoRepoDir))
        
mkdir(szRepoRepoDir)
    
    if(!
file_exists(szFile)) 
    { 
        
write_file(szFile"")
    } 
    
    new 
szName[128], szURL[256], szWgetPath[256]
    new 
iLineiLengthsBuffer[256]
    
    while(
read_file(szFileiLine++, sBuffercharsmax(sBuffer), iLength)) 
    {         
        if((
sBuffer[0]== ';') || !iLength
            continue
        
        
strtok(sBufferszNamecharsmax(szName), szURLcharsmax(szURL), '|'0)
        
        
formatex(szWgetPathcharsmax(szWgetPath), "%s/%s.txt"szRepoRepoDirszName)
        
        
server_print(szURL)
        
server_print(szWgetPath)
        
        
HTTP2_Download(szURLszWgetPath"wget_ReposDone")
    } 

__________________
Kia is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-08-2013 , 10:15   Re: [INC] HTTP2
Reply With Quote #14

Could you please share the repo file that's included in the problem aswell?
__________________
Black Rose is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 09-08-2013 , 10:15   Re: [INC] HTTP2
Reply With Quote #15

__________________
Kia is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-08-2013 , 10:23   Re: [INC] HTTP2
Reply With Quote #16

Thank you for your help in debugging this, you can remove your code if you want.
I'll be uploading a new version that solves your problem in about 5 minutes.
Sorry for any inconvenience.
__________________

Last edited by Black Rose; 09-08-2013 at 10:26.
Black Rose is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 09-08-2013 , 10:34   Re: [INC] HTTP2
Reply With Quote #17

Works like a charm, thanks.

Quote:
Repo addons/amxmodx/configs/xRepo/re successfully downloaded, 0.00MB, Errors: 0
__________________
Kia is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-09-2013 , 17:18   Re: [INC] HTTP2
Reply With Quote #18

For anyone interested. Just a proof of concept.

This plugin will make it possible to download and install plugins from AMXx database directly from the game through menus. Just say /plugins (This command is probably already used. It really should be changed.)
It could do with possibly one rewrite and some small fixes (for example filter unnecessary mods in "All" section and a check for failed compiles).

If anyone wants to develop this further and release it in any form, go ahead. I claim no rights.

Requires: HTTP2 (sockets + fakemeta) and regex.

I will add screenshots in a day or two to explain better.
Attached Files
File Type: sma Get Plugin or Get Source (dl_and_install_plugins_from_game.sma - 531 views - 10.8 KB)
__________________

Last edited by Black Rose; 09-10-2013 at 12:41.
Black Rose is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-09-2013 , 18:29   Re: [INC] HTTP2
Reply With Quote #19

It has been already done by someone, don't remember who though.

EDIT : maybe this one : https://forums.alliedmods.net/showthread.php?p=774988 ?
__________________
Arkshine is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-09-2013 , 18:33   [INC] HTTP2
Reply With Quote #20

Goddamnit.

EDIT: I checked the file you linked. It supports download using the plugin id, the sample I created is more of a browsing experience.
Basically parsing this page and then parsing the plugin page.

EDIT2: Here are some images to explain better.



I know it says "a plugins", I fixed that and reuploaded.




Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	531
Size:	26.0 KB
ID:	125650   Click image for larger version

Name:	2.png
Views:	501
Size:	41.8 KB
ID:	125651   Click image for larger version

Name:	3.jpg
Views:	494
Size:	25.9 KB
ID:	125652   Click image for larger version

Name:	4.png
Views:	495
Size:	33.7 KB
ID:	125653   Click image for larger version

Name:	5.png
Views:	494
Size:	10.0 KB
ID:	125654  

__________________

Last edited by Black Rose; 09-11-2013 at 16:19.
Black Rose is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode