B4J Question OkHTTPUTILS2 and B4Xlib

monki

Active Member
Licensed User
Longtime User
Hello Erel,
I have created a B4XLIB for the Tr64 protocol, for this I use OKHTTPUtis2 to enable host access via HTTPS you have to enter HU2_ACCEPTALL in the project configuration.
Is it possible if I then use the library in a project to make this entry automatically or to configure it in the HTTPUTILS?
monki
 

monki

Active Member
Licensed User
Longtime User
hello Erel,
would it be possible to expand the HTTPUtils by an option like okhhttp for example j.Initialize ("", Me, ACCEPTALL as Boolean) or in order not to change the compatibility as an additional variant for example as j.InitializeACCEPTALL ("", Me) ?
monki
 
Last edited:
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
in the internal libraries fold of b4j there are 2 b4xlibs relating to okhttp. whichever one you're linking to, copy it from the internal folder to your additional libraries folder. rename it (important). you are then free to modify it as you wish. just make sure to include it when you build your project. i have a modified version which uses the acceptall "feature", as well as a trap for 3xx http errors. the standard okhttputils b4xlib is still available and untouched by the modified
version. no need to add the accept_all compiler directive.

i understand what you're trying to do. i went that way first. it's even possible to have both available in the same project and to call the modified version as needed. i think it's cleaner to separate things. have a modified version separate from the regular version (obviously under a different name).

it's not a good idea to use acceptall. on the android side, google would reject any app that blindly ignores security issues. on the tri64 side, if somebody downloads a file from a bad source, there could be problems for you for having allowed it (even if you warn users and give them a choice). downloading with httutils is benign, given that the downloaded data is just inactive bytes. but you may have no control over what happens with those bytes (eg, somebody loads them into a browser). have your lawyer on retainer.
 
Last edited:
Upvote 0

monki

Active Member
Licensed User
Longtime User
@drgottjr
Modifying the http utils would certainly be a solution. But this would no longer guarantee compatibility when using the library by other users because I would then have to deliver the modified version. It would be better if erel could incorporate the suggestions I mentioned above. Thus, users could also use my library
 
Upvote 0
Top