winhttp icon indicating copy to clipboard operation
winhttp copied to clipboard

Websockets not implemented

Open Symbolics opened this issue 4 years ago • 8 comments

Great idea for this library, and much appreciated for those of us on MS Windows. Just a request here for including the websockets portion of the WinHTTP API.

Question: if you were going to add the websocket API, would you hand-wrap the functions (as it appears was done here), or auto generate with something like cl-autowrap?

Symbolics avatar May 28 '20 03:05 Symbolics

Thanks, I was frustrated with drakma’s use of cl+ssl on windows so I needed an http client that worked reliably. I’ve since made a patched version of drakma that uses schannel instead of cl+ssl so I don’t use this lib anymore. But I agree the websocket part might be rather useful. I usually just type in the ffi by hand, it only looks like a few functions that need adding.

fjames86 avatar May 28 '20 08:05 fjames86

I'll have a go at it then. A drakma API wrapper would be useful too so that you could winhttp in place of drakma on MS Windows platforms. Have you got a CFFI reference for the hand-wrapping?

Symbolics avatar May 28 '20 13:05 Symbolics

I've just added some of them but I've not used them so have no idea if they even work - feel free to have a go and let me know if there are any changes required, or do a pull request if you want.

To wrap FFIs by hand I just copy the header info from MSDN and type the equivalent CFFI form. Unless there are complicated structs it is quite easy.

fjames86 avatar May 28 '20 14:05 fjames86

Thank you for winhttp.

I also was very frustrated with drakma’s use of cl+ssl on windows: I was never able to have it work with LispWorks 64-bit on Windows 10.

Earlier on you mentioned,

I’ve since made a patched version of drakma that uses schannel instead of cl+ssl so I don’t use this lib anymore.

Would you share such patch, perhaps try to merge it upstream?

I also wanted to ask if there is any reason you did not consider using dexador? I have been told dexador does not cover all corner cases as well as drakma does, that is why I am interested in your patch.

PS: Although the README says "...for those few Common Lisp Windows users", I know winhttp has been helping quite a few of us. Thanks!

lispstudent avatar Sep 16 '20 16:09 lispstudent

Hi @lispstudent thanks for your interest and kind comments.

Would you share such patch, perhaps try to merge it upstream?

Well, I have my patched versions freely available on my github for anyone who would prefer them. But there is a technical reason why I think it would be inappropriate to merge these changes into drakma/hunchentoot main. Firstly, it changes expected behaviour: e.g. rather than taking certificates from external files, instead it takes certificates from the Windows certificate store. Secondly, I had a hard time trying to get usocket to play nice with my schannel library (the core library that implements TLS on Windows). So I had to use my own socket library (fsocket) which, although freely available on my github, is not distributed e.g. on quicklisp. So we'd need to add that too.

I also wanted to ask if there is any reason you did not consider using dexador?

Honestly I don't think I was aware of dexador at the time, and actually I've never used it.

I think one key advantage that Winhttp has over e.g. drakma is it natively supports Windows SSO authentication (i.e. Active Directory/Kerberos). This is potentially something quite useful. A few years ago I wrote a Kerberos implementation in Lisp and a plugin for drakma that allowed this (it worked at the time, probably still works now), but you can't get seamless SSO that way.

fjames86 avatar Sep 17 '20 07:09 fjames86

Doesn’t dexador use winhttp for Windows?

Sent from my iPhone

On 17 Sep 2020, at 15:56, Frank James [email protected] wrote:

Hi @lispstudent thanks for your interest and kind comments.

Would you share such patch, perhaps try to merge it upstream?

Well, I have my patched versions freely available on my github for anyone who would prefer them. But there is a technical reason why I think it would be inappropriate to merge these changes into drakma/hunchentoot main. Firstly, it changes expected behaviour: e.g. rather than taking certificates from external files, instead it takes certificates from the Windows certificate store. Secondly, I had a hard time trying to get usocket to play nice with my schannel library (the core library that implements TLS on Windows). So I had to use my own socket library (fsocket) which, although freely available on my github, is not distributed e.g. on quicklisp. So we'd need to add that too.

I also wanted to ask if there is any reason you did not consider using dexador? Honestly I don't think I was aware of dexador at the time, and actually I've never used it.

I think one key advantage that Winhttp has over e.g. drakma is it natively supports Windows SSO authentication (i.e. Active Directory/Kerberos). This is potentially something quite useful. A few years ago I wrote a Kerberos implementation in Lisp and a plugin for drakma that allowed this (it worked at the time, probably still works now), but you can't get seamless SSO that way.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Symbolics avatar Sep 17 '20 08:09 Symbolics

Thank you very much for explaining, all clear now.

I had a hard time trying to get usocket to play nice with my schannel library (the core library that implements TLS on Windows). So I had to use my own socket library (fsocket) which, although freely available on my github, is not distributed e.g. on quicklisp. So we'd need to add that too.

I believe having fsocket on quicklisp would be useful to many.

In my personal case, I use a PC with Windows 10 at home (my own LispWorks license) and a Unix terminal at school, so I would prefer to use a multiplatform solution. I am still a bit hesitant to use dexador though.

lispstudent avatar Sep 17 '20 12:09 lispstudent

Doesn’t dexador use winhttp for Windows?

Ha that's news to me. I never knew it was being used by any thing else.

fjames86 avatar Sep 17 '20 12:09 fjames86