Advertising (This ad goes away for registered users. You can Login or Register)

Oslib and https,how to work with it?

Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Post Reply
abbateur
Posts: 2
Joined: Sun Oct 18, 2015 1:01 am

Oslib and https,how to work with it?

Post by abbateur » Wed Jan 06, 2016 5:30 pm

I have following code that should download page source into file:

Code: Select all

#include <pspkernel.h>
#include <oslib/oslib.h>

#define printf oslPrintf

PSP_MODULE_INFO("Net Test", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(6*1024);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Globals:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


static int runningFlag = 1;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Callbacks:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
    runningFlag = 0;
    return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
    int cbid;

    cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCallback(cbid);
    sceKernelSleepThreadCB();
    return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
    int thid = 0;
    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, PSP_THREAD_ATTR_USER, 0);
    if(thid >= 0)
        sceKernelStartThread(thid, 0, 0);
    return thid;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Init OSLib:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int initOSLib(){
    oslInit(0);
    oslInitGfx(OSL_PF_8888, 1);
    oslInitAudio();
    oslSetQuitOnLoadFailure(1);
    oslSetKeyAutorepeatInit(40);
    oslSetKeyAutorepeatInterval(10);
    return 0;
}


int connectAPCallback(int state){
    oslStartDrawing();
    oslCls();
    printf("Connecting to AP... \n");
    printf("State: %i \n", state);
    oslCls();
    return 0;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main(){
    SetupCallbacks();
    initOSLib();
    oslNetInit();
    pspDebugScreenInit();
    printf("Inintializing network test,prepare to git gud! \n");
    int networkact = oslIsNetActive();
    printf("Current Netinit state: %d \n",networkact);
    oslConnectToAP(1,30,connectAPCallback);
    int internetcheck = oslIsNetActive();
    printf("Current connection state: %d \n",internetcheck);
    oslNetGetFile("https://vk.com/","test.txt");
    printf("Seems like it's ok... \n");
    //printf("Status 1: %d | Status 2: %d",networkact,internetcheck);
    
    sceKernelSleepThread();
    return 0;

}
The problem is in oslNetGetFile function (line 84) which works only if i use any http:// url instead of https:// .

I heard about ssl problem on firmwares older than 6.61,so i upgraded to 6.61 promod-c2p yet problem is still here,so i think there is code error somewhere,but i lack experience to find it out by myself.
Also default webbrowser loads this site without problems.
Anyone know how to fix this error,or any other library/solution please reply :)
Advertising

Post Reply

Return to “Programming and Security”