TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Nope.c – A web framework with a tiny footprint

108 点作者 amandle将近 11 年前

18 条评论

paraboul将近 11 年前
Looking at the source code : <a href="https://github.com/riolet/nope.c/blob/c883b11df78bb8115d5e51dda752b3006fd09979/nope.c#L278" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;riolet&#x2F;nope.c&#x2F;blob&#x2F;c883b11df78bb8115d5e51...</a><p>It tries to copy a buffer of 1024 byte (max) into a buffer of 512 bytes (by executing a request with an URL longer than 512 bytes).<p>It also runs 15 children process and use blocking socket, meaning that it&#x27;s easily &quot;DoS&#x27;able&quot;.<p>The overall code seems very &quot;unsecure&quot; and poorly designed.
评论 #8084819 未加载
评论 #8084741 未加载
评论 #8087144 未加载
评论 #8086229 未加载
captainmuon将近 11 年前
This site feels ridiculously fast. I&#x27;ve noticed that with other compiled frameworks too, e.g. CppCMS: <a href="http://cppcms.com/wikipp/en/page/main" rel="nofollow">http:&#x2F;&#x2F;cppcms.com&#x2F;wikipp&#x2F;en&#x2F;page&#x2F;main</a><p>I wonder if it is just the lightweight HTML the websites use, or if there is really so much speed to gain from using a compiled language.
评论 #8085239 未加载
评论 #8084681 未加载
评论 #8084662 未加载
评论 #8084701 未加载
评论 #8084687 未加载
评论 #8087130 未加载
nly将近 11 年前
It&#x27;s strange how a piece of code any dev could, and likely would, have written in 1992 can now reach the HN front page.<p>Isn&#x27;t it odd that this kind of minimalism is now considered novel?<p>(Not that I&#x27;m bashing the author. Doing this stuff was fun in the 90s and it&#x27;s still fun now)
评论 #8085093 未加载
peterwwillis将近 11 年前
People... please. Don&#x27;t implement protocols or network servers yourself. There&#x27;s about a billion http servers out there, and some of them are even good. Most popular http servers let you compile custom modules that run in the same process, which would have the same effect as Nope.c but without all the flaws.<p>If you need a C http implementation with a tiny footprint, grab a tiny http server that has been around for a long time (there are many) and hack on it. Busybox httpd, thttpd, boa, etc all come to mind, and there&#x27;s probably dozens more. But even those support CGI, and it&#x27;ll be much more scalable to not have to re-compile and re-ship and re-start your entire http process every time you need to edit a page.<p>Write your CGI&#x2F;FastCGI&#x2F;whatever app in C, compile it, and let the http server run it. It&#x27;s much better suited to deal with securing the connection and handling the fucked-up edge cases of different browsers, platforms, proxies, RFCs, tcp&#x2F;ip stacks, etc etc etc. As a hack, if your environment has a shell, write your CGI web apps in shell script; it compresses great, can be edited on the fly, and uses existing system resources.<p>I have written http server implementations. I have written boatloads of server-side applications. I&#x27;ve even written an entire CGI web interface and framework in C. It&#x27;s fucking abysmal. Unless you&#x27;re writing a hello world app, trust me, you don&#x27;t want to use C.
filmgirlcw将近 11 年前
I think HN just broke your server.<p>Edit: Just read the linked Reddit thread, looks like there were some security issues. But hey, that&#x27;s the power of open source, right? People can tell you instantly when shit is broken or unsafe.
评论 #8084750 未加载
datenwolf将近 11 年前
I responded on Reddit with a link to my litheweb (the sources still say picoweb throughout it. I yet have to rename-refactor it).<p><a href="https://github.com/datenwolf/litheweb" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;datenwolf&#x2F;litheweb</a><p>Lithweb is developed network API agnostic and requires no dynamic memory allocation (malloc&#x2F;free). Its main target are microcontrollers and it has a memory footprint of as little as 0.5kiB. To make it work you&#x27;ll have to provide an implementation of the ioops functions.<p>GET variable support has the scaffolding up, but URL parameter parsing not yet implemented.<p>However POST request support it fully implemented, including MIME Multipart reconstuction.<p>See the test&#x2F;bsdsocket.c for an example on how to implement ioops and for a file upload example.<p>So far the repositry does not contain the tag nesting functions, but I have those, too.<p>Security issues? Probably some but so far not identified yet. However when I tried fuzzing it, the fuzzer got crashed by litheweb %) (litheweb was not impressed).
regi将近 11 年前
How come this code has 117 stars on github?!<p>Here&#x27;s something that is probably safer and that actually scales: <a href="https://github.com/reginaldl/librinoo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;reginaldl&#x2F;librinoo</a>
bebna将近 11 年前
Better use nxweb, this one isn&#x27;t that secure: <a href="http://www.reddit.com/r/programming/comments/2bo44u/i_am_the_developer_behind_nopec_an/cj79zka" rel="nofollow">http:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;programming&#x2F;comments&#x2F;2bo44u&#x2F;i_am_the...</a>
评论 #8085244 未加载
评论 #8084942 未加载
评论 #8085645 未加载
评论 #8085139 未加载
anon4将近 11 年前
Why wouldn&#x27;t one write something like that directly as an httpd or nginx module? You get fastest possible C http server, together with a very good utility library and just need to write your own routing and handling functions. I mean, why rewrite the server component when you can just use an existing one? I can see not wanting to use one of the CGI interfaces for maximum performance (and ultimate fun), but there&#x27;s very little point in rewriting the http(s) handling yet again.
synack将近 11 年前
Calling recv one byte at a time is high performance? Nope.
forgottenpass将近 11 年前
When you cross-posted this from reddit you forgot to retain the context:<p><i>I am the developer behind nope.c: an ultra-lightweight network application platform for C language. It&#x27;s early days, so, could I have some feedback please? Thanks. And, yes, the website is hosted runs on nope.c.</i><p>Sure it&#x27;s buggy as hell, but it doesn&#x27;t actually matter yet because the author isn&#x27;t presenting it as more developed than it is.
general_failure将近 11 年前
The code is filled with bloopers.
Artemis2将近 11 年前
Looks great! You might want to fix the &quot;node.c&quot; that appears on a few pages (for instance the documentation), and limit the maximum value one can input into your factors calculator.
callesgg将近 11 年前
Nice try, a bit buggy but nothing that can&#x27;t be solved.<p>Even tho people here on HN seams a but harsh there is some good lessons to be learned from them.
jackweirdy将近 11 年前
&quot;This webpage is not available&quot;
评论 #8084717 未加载
jvandonsel将近 11 年前
Minor comment in your sample code: When searching for factors of N you only need to search up to sqrt(N).
abimaelmartell将近 11 年前
Poorly coded, no standards, also is vulnerable to DOS and memory leaks...
natch将近 11 年前
First link on the documentation page is:<p>Build a simple app using node.c<p>node? Typo?
评论 #8087288 未加载