kristapsdz / kcgi

minimal CGI and FastCGI library for C/C++
https://kristaps.bsd.lv/kcgi
ISC License
275 stars 40 forks source link

No interface to `sock_ctl` on fcgi struct #105

Closed swagtoy closed 10 months ago

swagtoy commented 1 year ago

Hi! I'm writing an application that uses regular FCGI libs, but I decided to give this one a look, and I noticed a design flaw for a feature I needed.

In my application, I poll a curl socket and FCGIapp socket, so I may use an Asynchronous design. With this library, this isn't possible since the kfcgi struct's implementation isn't exposed.

(more over, why isn't this typedef'd if you didn't plan to expose the API, and wanted to treat it as a regular type? Struct at least confirms that I could get at the data)

kristapsdz commented 10 months ago

The struct in the kcgi.h file are forward declarations: the API only uses pointers. And as a matter of style, I don't use typedefs on structs.

You do raise a good point, though: internally, the khttp_fcgi_parse function just calls fcgi_waitread on the sock_ctl value, so it should be possible to to integrate this into an existing polling loop. I'll add a function to grab this value and will close this issue when it's done.