[{"data":1,"prerenderedAt":339},["ShallowReactive",2],{"project-2520882":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":28,"sentiment":29,"stance_mix":30,"scored_comments":35,"aspects":36,"strip":42,"post_text":44,"what":45,"said":89,"maker_in_thread":207,"shape":216,"grid":219,"attempts":303,"same_week":304,"maker_shows":43,"maker_hidden":332,"reader_version":333,"card":334},"2520882","Lacewing","My embeddable C\u002FC++ webserver","title","Show HN: My embeddable C\u002FC++ webserver","https:\u002F\u002Fgithub.com\u002Fudp\u002Flacewing\u002Fblob\u002Fmaster\u002Fexamples\u002Fhello_world.cc","github.com","udp",1304689305,2011,84,44,138,1097,13,"notable","languages","networking library","library",[24,25,26,27],"c++ webserver","embeddable webserver","epoll kqueue iocp","c networking library","curious",-0.04,{"positive":31,"neutral":32,"mixed":33,"critical":34},4,14,1,6,25,{"idea":37,"execution":39},{"positive":38,"critical":33},0,{"positive":40,"critical":41},2,5,[38,43,38,43,38,43,38,38,43,43,38,41,43,41,41,38,43,33,38,33,43,38,38,38,33,38,38,43,38,33,41,43,38,33,33,38,43,43,38,43],3,null,{"problem":46,"audience":53,"pricing":44,"motivation":62,"time_to_build":44,"stack":66,"openness":86,"stage":87,"team_size":88},{"value":47,"source":48,"evidence":49},"Adding a lightweight web server into C\u002FC++ applications, especially on Windows","maker",[50],{"id":51,"by":11,"text":52},"2520939","I suppose it's just meant to be easily embeddable into just about anything. It could be used to add webserver functionality into an existing application (think web control…",{"value":54,"source":55,"evidence":56},"C\u002FC++ developers embedding web interfaces or backends","inferred",[57,58],{"id":51,"by":11,"text":52},{"id":59,"by":60,"text":61},"2520960","dkersten","Thanks for sharing! I was actually looking for a lightweight embeddable C\u002FC++ web server not long ago, perhaps this will fit my needs. Only thing I'm wondering about is does it…",{"value":63,"source":48,"evidence":64},"Node.js Windows support plans prompted release; wanted a C\u002FC++ web server that runs well on Windows",[65],{"id":51,"by":11,"text":52},[67,73,80],{"value":68,"source":48,"evidence":69},"C++",[70],{"id":71,"by":11,"text":72},"2520883","This webserver is the most complete part of a high-level, cross-platform networking library I've been working on. The rest of the examples:…",{"value":74,"source":48,"evidence":75},"epoll, kqueue and IOCP event handling",[76,77],{"id":71,"by":11,"text":72},{"id":78,"by":11,"text":79},"2520971","Yes, I've used it on both Windows and OS X, as well as Linux and FreeBSD servers. It uses IOCP on Windows and kqueue on OS X. There's a project file in the 'msvc' folder which…",{"value":81,"source":48,"evidence":82},"OpenSSL on Unix, native SSL on Windows",[83],{"id":84,"by":11,"text":85},"2521570","I support epoll and IOCP, too, and I don't consider event handling something complicated enough to justify bringing in an external library. I quite value the freedom of…","open_source","beta","unknown",{"praise":90,"objections":107,"requests":135,"questions":162,"alternatives":181},[91,103],{"value":92,"source":93,"evidence":94},"Clean, readable, well-laid-out code","commenter",[95,99],{"id":96,"by":97,"text":98},"2521187","munificent","Wow. Your code is a joy to read. Really clean and well-laid-out.",{"id":100,"by":101,"text":102},"2522733","epidemian","Awesome way of doing assertions! https:\u002F\u002Fgithub.com\u002Fudp\u002Flacewing\u002Fblob\u002Ff1c6386bf33f470ff61b275cf408282781625018\u002Fsrc\u002FCommon.h#L79 I remember I used to do something like that in C++…",{"value":104,"source":48,"evidence":105},"Cross-platform support on Windows, OS X and Linux",[106],{"id":78,"by":11,"text":79},[108,122,128],{"value":109,"source":93,"evidence":110},"Security issues: unchecked lengths, path traversal, cookie header injection",[111,115,119],{"id":112,"by":113,"text":114},"2520972","tptacek","+12? +8? ``` char * NameDecoded = (char *) malloc(strlen(Name) + 12); char * ValueDecoded = (char *) malloc(strlen(Value) + 12); if(!URLDecode(Name, NameDecoded, strlen(Name) +…",{"id":116,"by":117,"text":118},"2522152","zwp","Small potatoes but this: ``` for(char * i = this->URL; *i; ++ i) { if(i[0] == '.' && i[1] == '.' && (i[2] == '\u002F' || i[2] == '\\\\')) ``` misses the case where the double dot is not…",{"id":120,"by":117,"text":121},"2523658","Bigger potatoes: output sanitization? Eg only whitespace is trimmed from cookies, then in webserver.Outgoing.cc: ``` Socket \u003C\u003C \"\\r\\nSet-Cookie: \" \u003C\u003C Current->Key \u003C\u003C \"=\" \u003C\u003C…",{"value":123,"source":93,"evidence":124},"Not well tested; not safe for production use",[125],{"id":126,"by":113,"text":127},"2521322","Mongoose is only selecting for the listening socket, so the comparison there isn't particularly valid. Mongoose scales as well as threads on its platform scale. Mongoose also…",{"value":129,"source":93,"evidence":130},"Ad-hoc HTTP parser",[131],{"id":132,"by":133,"text":134},"2521411","sigil","In src\u002Fwebserver\u002FWebserver.Incoming.cc you have an ad-hoc HTTP parser that internally buffers partial request data and does some questionable things like recursing on each…",[136,140,147,151],{"value":137,"source":93,"evidence":138},"Use a standard HTTP parser library",[139],{"id":132,"by":133,"text":134},{"value":141,"source":93,"evidence":142},"Drop multithreading in favour of single-threaded reactor",[143],{"id":144,"by":145,"text":146},"2521288","udoprog","I honestly believe that you should avoid multithread support and instead focus on the current single threaded reactor pattern. Any developer found easily just attach something…",{"value":148,"source":93,"evidence":149},"Windows and Mac build support",[150],{"id":59,"by":60,"text":61},{"value":152,"source":93,"evidence":153},"Switch build system to SCons or plain Makefile",[154,158],{"id":155,"by":156,"text":157},"2521892","misham","Have you considered using Scons as your build system, instead of Automake?",{"id":159,"by":160,"text":161},"2522431","jff","I think a question people should often ask themselves is: Have you considered if you need a build system at all? Is this something I can properly build with a plain old Makefile?",[163,170],{"value":164,"source":93,"evidence":165},"Can it be embedded in an iOS app?",[166],{"id":167,"by":168,"text":169},"2521160","jason_slack","what about embedding in an iOS app? Any thoughts on this and if Apple will let is pass?",{"value":171,"source":93,"evidence":172},"How does it compare to Mongoose, libmicrohttpd or cpp-netlib?",[173,177],{"id":174,"by":175,"text":176},"2521138","k_shehadeh","Encouraging to see more development in this space. Thanks. I'm curious, though. How do you think this compares with the mongoose (http:\u002F\u002Fcode.google.com\u002Fp\u002Fmongoose\u002F) project.…",{"id":178,"by":179,"text":180},"2521374","mellery451","Thanks for sharing. How does the basic functionality compare with, say, http:\u002F\u002Fwww.gnu.org\u002Fsoftware\u002Flibmicrohttpd\u002F or http:\u002F\u002Fcpp-netlib.github.com\u002F ? (the latter looks like it…",[182,186,192,199,203],{"value":183,"source":93,"evidence":184},"Mongoose",[185],{"id":174,"by":175,"text":176},{"value":187,"source":93,"evidence":188},"libevent",[189],{"id":190,"by":113,"text":191},"2521350","Yes, iOS has working kqueue. I have some reason to believe you can get libevent working on iOS with minimal drama; I think there's at least one app that embeds it. Which, by the…",{"value":193,"source":93,"evidence":194},"libebb",[195],{"id":196,"by":197,"text":198},"2521660","luckystrike","You can also check out libebb - http:\u002F\u002Ftinyclouds.org\u002Flibebb\u002F",{"value":200,"source":93,"evidence":201},"libmicrohttpd",[202],{"id":178,"by":179,"text":180},{"value":204,"source":93,"evidence":205},"cpp-netlib",[206],{"id":178,"by":179,"text":180},{"comments":208,"answered":209,"key":210},16,8,[211,212,213],{"id":71,"text":72},{"id":51,"text":52},{"id":214,"text":215},"2521224","It would certainly be interesting to try - do you know if kqueue is available on iOS? If not, I guess the only thing to do would be writing a select() or poll() fallback for the…",{"commenters":217,"max_depth":209,"maker_replies":208,"first_comment_mins":38,"lifespan_hours":218},18,31,[220,222,226,227,228,230,231,232,235,238,241,242,243,246,247,249,251,254,255,257,259,260,262,264,266,269,271,272,274,276,279,281,282,284,286,287,289,291,292,294,297,298,300,302],[71,38,38,221,11,33],"project\u002Fneutral\u002Fnone",[223,38,43,224,225,38],"2520930","project\u002Fneutral\u002Fidea","Yoric",[51,38,38,224,11,33],[167,38,43,224,168,38],[214,38,38,229,11,33],"project\u002Fneutral\u002Fexecution",[190,38,43,229,113,38],[84,38,38,229,11,33],[233,38,38,234,113,38],"2521602","commenter\u002Fneutral\u002Fexecution",[236,38,43,224,237,38],"2521284","jasonlotito",[239,38,43,224,240,38],"2523086","benologist",[59,38,43,221,60,38],[78,38,38,229,11,33],[244,38,41,245,60,38],"2520983","maker\u002Fpositive\u002Fnone",[196,38,43,221,197,38],[248,38,41,245,60,38],"2522226",[96,38,41,250,97,38],"maker\u002Fpositive\u002Fexecution",[252,38,38,253,11,33],"2521216","maker\u002Fneutral\u002Fexecution",[178,38,43,224,179,38],[112,33,33,256,113,38],"project\u002Fcritical\u002Fexecution",[258,33,38,229,11,33],"2520977",[116,33,33,256,117,38],[261,33,38,229,11,33],"2522179",[263,33,43,229,113,38],"2522190",[265,33,38,229,11,33],"2522208",[267,33,38,268,113,38],"2522254","commenter\u002Fneutral\u002Fnone",[270,33,38,234,117,38],"2522213",[120,33,33,256,117,38],[273,33,38,229,11,33],"2523723",[275,33,38,229,11,33],"2523985",[277,33,43,278,117,38],"2524270","project\u002Fmixed\u002Fexecution",[280,33,38,229,11,33],"2524557",[132,40,33,256,133,38],[283,40,38,229,11,33],"2521457",[100,43,41,285,101,38],"project\u002Fpositive\u002Fexecution",[174,31,43,224,175,38],[288,31,38,224,11,33],"2521166",[144,31,33,290,145,38],"project\u002Fcritical\u002Fidea",[126,31,33,256,113,38],[293,31,38,229,11,33],"2521362",[295,31,43,221,296,38],"2521523","personalcompute",[155,41,43,229,156,38],[299,41,38,229,11,33],"2521940",[301,41,43,229,156,38],"2521983",[159,41,43,229,160,38],[],[305,310,314,319,323,328],{"id":306,"name":307,"points":308,"category":309},"2519082","Gitalytics.com",83,"dev_tools",{"id":311,"name":312,"points":313,"category":309},"2520317","plugins.atlassian.com",42,{"id":315,"name":316,"points":317,"category":318},"2529322","Html5Snippets.com",29,"learning_science",{"id":320,"name":321,"points":322,"category":309},"2517848","underthesite",22,{"id":324,"name":325,"points":326,"category":327},"2523192","Gabriel",19,"infrastructure",{"id":329,"name":330,"points":217,"category":331},"2538071","Fast, free online meetings","web_saas",false,"v2",{"id":335,"name":5,"line":6,"ai":332,"cat":20,"year":13,"points":14,"comments":15,"rec":28,"s":29,"top":18,"kw":336,"maker":11,"domain":10,"tier":19,"attempts":38,"strip":337,"url":9,"mix":338,"praise":92,"objection":109,"sub":21},2520882,[24,25,26,27],"0303030033053550310130001003015301103303",[31,32,33,34],1794036488194]