Raised This Month: $ Target: $400
 0% 

Sockets HTTPs on GitHub


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GuskiS
Veteran Member
Join Date: Aug 2007
Location: Latvia
Old 11-08-2014 , 10:19   Sockets HTTPs on GitHub
Reply With Quote #1

Hello. I'm trying to make an version check via github, but can't seem to get connected to github:
https://raw.githubusercontent.com/Gu...sion_check.txt
PHP Code:
#include <amxmodx>
#include <sockets>

new g_pSocket;

#define SCRIPT_NAME "/GuskiS/Trouble-in-Terrorist-Town/master/version_check.txt"
#define REMOTE_HOST "raw.githubusercontent.com"

public plugin_init()
{
    
set_task(5.0"connect_web");
}

public 
connect_web()
{
    new 
error;
    
g_pSocket socket_open(REMOTE_HOST443SOCKET_TCPerror);
    if(
g_pSocket 0)
    {
        new 
string[140];
        
formatex(stringcharsmax(string), "GET %s HTTP/1.1^nHost: %s^n^n"SCRIPT_NAMEREMOTE_HOST);
        
socket_send(g_pSocketstringcharsmax(string));
        
read_web();
    }
    else
    {
        switch(
error)
        {
            case 
1server_print("Error creating socket");
            case 
2server_print("Error resolving remote hostname");
            case 
3server_print("Error connecting socket");
        }
    }
}

public 
read_web()
{
    new 
text[2048];
    
socket_recv(g_pSockettextcharsmax(text));
    
server_print("^n%s"text);
    
server_print("%s^n"text[254]);

Output:
Code:
HTTP/1.1 400 Bad Request
Date: Sat, 08 Nov 2014 15:10:45 GMT
Server: Apache
Content-Length: 362
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request<
title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Reason: You're speaking plain HTTP to an SSL-enabled server port.<br />
Instead use the HTTPS scheme to access this URL, please.<br />
Is it even possible?
__________________
Finished mods:
Trouble in Terrorist Town
MurderMod
The Hidden
Cowboys vs Indians
JailBreak Supreme
Survival Madness

Last edited by GuskiS; 11-08-2014 at 10:22.
GuskiS is offline
 



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 17:35.


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