ps3dev / PSL1GHT

A lightweight PS3 SDK
www.psl1ght.com
MIT License
222 stars 62 forks source link

issue with http definitions #89

Closed bucanero closed 4 years ago

bucanero commented 4 years ago

Some time ago I was trying to download a file using the PS3 internal HTTP methods, but I was getting an error after calling httpCreateTransaction():

Error : httpCreateTransaction() failed (80710010)

After talking with other PS3 devs, I figured out that it was due to a problem in the httpClientId definition (0x80710010 = "Not a proper client ID"): <http/http.h>

struct httpClient;
struct httpTransaction;

typedef struct httpClient* httpClientId;
typedef struct httpTransaction* httpTransId;

Checking Estwald's PSDK3v2 fork, I found he changed the typedefs to s32, for example: typedef s32 httpClientId; (he also changed size_t references to s32) https://github.com/Estwald/PSDK3v2/commit/c920bc3e2c0fcb7c7d0e03e0be323625aa24c0ba

Using his version of http.h, everything worked fine for me and I was able to fetch http stuff with the ps3.

So, my question: should we merge these changes into PSL1GHT? is there any reason for these differences?

miigotu commented 4 years ago

What if you just change those few typedefs?

typedef s32 httpClientId;
typedef s32 httpTransId;

typedef s32 httpSslId;

Seems there is a lot more done there than needs to be done.

bucanero commented 4 years ago

What if you just change those few typedefs?

I'll try changing only those typedefs and do some tests to see if everything works as it should.

I'll share my feedback when I get the results.

bucanero commented 4 years ago

I tested the changes in my PS3 homebrew app, and I had to apply these changes:

http.c

typedef s32 httpClientId;
typedef s32 httpTransId;

typedef s32 httpSslId;

https.c

typedef struct _https_data
{
  char *ptr ATTRIBUTE_PRXPTR;
  s32 size;
} httpsData;

Without those typedef changes, connections to http/https didn't work.

edit: I realized that my app code is still using s32 variables when calling the methods. I'll change to size_t and re-verify the results.

edit 2: when using size_t for variables calling the methods, everything fails again. I think that Estwald's definitions with s32 is the way to go. If I find some original documentation I'll cross-check it.

bucanero commented 4 years ago

I had the chance to check the cell docs about libhttp, and their definitions use size_t. Could it be that they're using a 32-bit definition of size_t ? in PSL1GHT size_t is 64-bit, that could explain why the functions fail in psl1ght when parameters are not defined as s32.

miigotu commented 4 years ago

Lets close this and continue in #97