Website Coding in C?

I just read the page http://www.meebo.com/ About Us and read this line: "plus, we are one of the few who still use C!"

Given that meebo is an online chat client, how do they work with C? How can they use C for the backend? How does it interact with the interface? For example, let's say a user creates a new account and a new directory has to be created, how does the information go from the front to the back?

Sorry if this is a wrong question.

thanks

Edit 1: The Intro tutorial for CGI was great. Any good books I can get in my library about this?

Thanks a lot for the guys!

+6
c
source share
5 answers

I don’t know how meebo does it, but given that it is a chat software, they probably have their own server written in C to handle the actual message traffic.

However, Apache and most other HTTP servers have always been able to call C programs in the same way that they can call PHP, CGI, and other languages ​​for specific requests. Some websites are even written in Lisp.

The backend must be compiled every time, unlike the interpreted language, but this happens during deployment and is part of the build / production scripts.

The permissions and user accounts that run in C must be carefully selected, and of course the C website suffers from the same problems that any other C program may claim, such as buffer overflows, segfault, stackoverflow etc. As long as you run it with reduced permissions, you better protect it, and this is no worse than any other language / platform / architecture.

For servers, however, it is still widely used - the gold standard, I suppose. You can find many servers written in Java, C ++, and any other language, but C just seems to be worth it.

-Adam

+9
source share

Meebo uses a custom Lighttpd module called mod_meebo . It does not fully answer your question, but I thought you might be interested.

+3
source share

I turned on non-blocking HTTP 1.1 servers in just 50 lines of code (sparse) or a few hundred (better), up to 5 thousand (safe). Servers will load dynamic shared objects in the form of modules for processing certain types of requests.

Parent code will handle connection tracking, save avitations, GET / POST / HEAD requests and pass them to handlers loaded at startup. I did this when I was working with a VERY small ulnar room on embedded devices that had some kind of web control panel. In particular, it is a device that controlled the power outputs.

The entry point to each DSO was determined by the URL and the method used (i.e. / foo behaved differently depending on the type of request it served).

My small server did a good job, could handle about 150 clients without forks or streams, and even had a beautiful small template system so that users of the user interface could change pages without the need for manual storage.

I would most decisively not use such a setting on any production site, even on your main guestbook welcome page.

Now, if all I have to do is listen on port 80/443, accept requests with a small POST payload, misinform them and redirect them with other clients ... it's a little different. But what is a given specific server that claims to be a web server, without using C to create dynamic pages.

+3
source share

Many server programs can be run in C, not to mention CGI programming . They can also be Using C with MySQL , which is very possible. But without access to their source code, we do not know how much C they use.

The claim that they are "one of the few who still use C" was probably just a joke. With statistics like this , I would hope so.

-John

+2
source share

You can see a good example website in C with source code: fossil .

It uses SQLite for the back.

+1
source share

All Articles