Skip to content

curl_easy_getinfo for CURLINFO_RESPONSE_CODE  #1

@tankorsmash

Description

@tankorsmash

Hi there,

Thanks for putting this together, it's been fun to use!

I'm not all that familiar with J, so feel free to close, but I'm writing this to track down the changes I had to make to in order to check the response code of the sample function in test/simple.ijs, I couldn't use the existing curl_easy_getinfo wrapper, because the wrapped libcurl function is variadic, and getinfo is meant to take a pointer to a long (*l), which is then mutated.

(I also had to change to dll path to the full path, or change the working directory of my script to wherever the libcurl.dll was located, as it wasn't globally available on my system.)

This was the code I ended up using to read the response code:

hex2num =: 3 : '16 #. ''0123456789abcdef'' i. tolower }. y '
'"libcurl.dll" curl_easy_getinfo i x i *l '(15!:0) curlinstancepointer; (2+ hex2num'#200000'); ,0

Where I changed the signature by removing the < to get access to all modified values, and changing the last x to a *l. I also used the wiki and this blogpost to help sort it out.

Thanks again!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions