gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Talks about HTTP server (Was: Re: Function move request.)


From: Maxthon Chan
Subject: Talks about HTTP server (Was: Re: Function move request.)
Date: Fri, 17 May 2013 03:50:44 +0800

Well it turned out that my darned project is forced into using CoreFoundation 
(I need CFRunLoop to manage some BSD sockets' lifetime, as it is a portable 
HTTP server written in Objective-C.)

If I recalled right, the first HTTP stack is written in Objective-C, on a NeXT 
box.

I have some web development experienced with ASP.net (as my current website 
homepage is written in C# hosted on a Linux server using Mono) while the web 
development suite for Objective-C, an equally powerful language as C#, is 
pretty much dead.

I analysed and discovered that in order to get the most out of ASP.net, 
Microsoft written their IIS in .net (version 7 up, I have a copy of Windows 
Server 2012 as a secondary OS on my MacBook Pro and the IIS 8 shipped with it 
is pretty much all .net).

This lead me to think: can I write an equally powerful HTTP server in an 
equally powerful language, Objective-C, given its significance in the history 
of World Wide Web.

And since the Objective-C language have improved vastly over decades, can I 
implement something similar to ASP.net, hosted on this server which is itself 
written in Objective-C?

I have some previous experience writing a HTTP server in both Objective-C and 
Visual Basic .net (sibling of C#, essentially the same language expressed in 
another flavor), but either (for Objective-C) a library I used or (for Visual 
Basic .net) a lack of progress in Mono's vbmc compiler prevented them from 
being ported.

Now I am starting over, implementing this server again, following more tightly 
as how Microsoft did to their IIS, but using direct access to Berkeley sockets 
and native features of either Apple's Foundation or GNUstep. And this server is 
designed to serve WebUIKit, my ASP.net clone in Objective-C best, just like 
what IIS did. (If you have ever ported an ASP.net from IIS to Apache/Mono stack 
you know the pains.)

What's more, the nature of Objective-C even allows me to wrap modules from 
other UNIX-based HTTP servers (like Apache's) into my design, without losing 
any compatibility. That is a bonus comparing to IIS (which did it over 
P/Invoke, which is in no way portable), seamless compatibility. (We all know 
how bundles work, and NDISWrapper is a good example in wrapping programs from 
one platform to another.)

However, this project is too big for my to finish myself. I hope any of you can 
come and help. This project license is yet to be decided (temporarily licensed 
under 2-clause BSD, subject to later change)

If you are interested, send me an issue on GitHub, 
https://github.com/xcvista/ohttpd2 or reply to this email, please. If you teams 
want it, I can sign the related documents.

在 2013-5-17,上午3:30,Luboš Doležel <address@hidden> 写道:

> On 05/16/2013 08:26 PM, Maxthon Chan wrote:
>> Well Apple documented CFRetain and CFRelease as replacements of
>> retain/release methods on NSObject which is prohibited with ARC, and
>> from an incident I discovered that:
>> 
>> 1) objc_retain and objc_release does exist on Apple's libobjc2, but
>> are private API that is not allowed to be used in App Store apps; 2)
>> CFRetain and CFRelease calls Apple's objc_retain and objc_release
>> internally. 3) By linking to Foundation on OS X, CoreFoundation is
>> also included as Foundation is linked to CoreFoundation.
> 
> 2) Of course. For objects that are not detected to be valid CF objects. Such 
> detection would then have to be moved into Base, which doesn't sound sane.
> 
>> My code have zero intention to use CoreFoundation and it is not
>> linked against (at least not by a -framework CoreFoundation), hence I
>> will not use CoreBase in the port. This is why I am asking if those
>> two functions can be moved.
> 
> Linking with Foundation on OS X means linking with CoreFoundation, as you 
> noted above in 3). Hence I don't see a problem in making this link explicit 
> with GNUstep. After all, you *are* calling CF functions!
> 
>> Apple built Foundation on top of CoreFoundation, thanks to Carbon.
>> GNUstep started fresh and built Base directly on top of libc (and
>> friends), leaving CoreBase out and awkward.
> 
> That's not true. Apple's Foundation is not built on top of CF. They are 
> intertwined for bridging reasons, but the codebase is separate.
> 
> The bridging goes both ways. Meaning:
> 
> * CF object:
> - C calls are handled by CF
> - ObjC calls are handled by CF too
> 
> * Foundation object:
> - ObjC calls are handhled by Foundation
> - C calls are handled by Foundation too
> 
>> If you are concerned about CoreBase, try implement it in Objective-C
>> and that will make the moved CFRetain and CFRelease useable. Actually
>> I think we can safely ditch current CoreBase implementation and start
>> fresh implementing it using Objective-C on top of Base, wrapping
>> Objective-C methods into C functions.
> 
> CoreBase contains features that cannot be nicely implemented on top of Base's 
> classes.
> 
> The best way forward IMO is for me to complete toll-free bridging and 
> contribute that to GNUstep. Hopefully in July/August. There isn't that much 
> work left, but I don't have time now.
> 
> -- 
> Luboš Doležel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]