Re: Compiling/configuring Mongoose to run Lua scripts?

2014-01-04 Thread Sergey Lyubka
://www.vogella.com/tutorials/Git/article.htmljust for this, is there a howto that shows how to compile Mongoose with support for Lua (and SQLite)? Thank you. On Friday, January 3, 2014 11:17:33 PM UTC+1, Sergey Lyubka wrote: Fixed broken link, thanks for pointing it out. It is https://github.com

Re: Compiling/configuring Mongoose to run Lua scripts?

2014-01-04 Thread Sergey Lyubka
instead of showing the output: ? print('HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n') ? html body p spanToday is:/span ? mg.write(os.date(%A)) ? /p /body /html On Sunday, January 5, 2014 12:52:15 AM UTC+1, Sergey Lyubka wrote: $ sudo apt-get install git $ git clone https

Re: Lua + SQLite semi-working: How to investigate?

2014-01-06 Thread Sergey Lyubka
Remove this line: sqlite3 = require('lsqlite3') After that, it should work. Explanation: require function loads lsqlite3 DLL installed by luarocks. DLL loading is not working under mongoose because Lua is compiled statically. sqlite3 object is available under mongoose by default, there is no need

Re: Lua + SQLite semi-working: How to investigate?

2014-01-06 Thread Sergey Lyubka
You're correct, Gilles, thank you! Also a download of pre-compiled binary for Windows or Mac is available at http://cesanta.com/#downloads -- You received this message because you are subscribed to the Google Groups mongoose-users group. To unsubscribe from this group and stop receiving emails

Re: Using lua pcall

2014-01-06 Thread Sergey Lyubka
On Mon, Jan 6, 2014 at 10:28 PM, Steve B tur...@gmail.com wrote: Hi Steve, a quick diagram of the query flow might help. I didn't get the picture of your setup to be able to answer. This example you gave: * local ok, sock = pcall(connect, host, 80, 0)if ok then

Re: Pre-built Linux binaries

2014-01-08 Thread Sergey Lyubka
On Wed, Jan 8, 2014 at 3:13 AM, JJ jeremy@gmail.com wrote: Hi Sergey, Would it be possible to post statically-linked binaries for Linux along with the existing Windows and Mac binaries? It would be more convenient to point people to such a build, since the GPL technically requires a

Re: Pre-built Linux binaries

2014-01-08 Thread Sergey Lyubka
On Wed, Jan 8, 2014 at 10:04 AM, Robin Gilks g8...@gilks.org wrote: Cover most people? Really? I use Mongoose extensively under Linux on MIPS, MIPSEL and ARM (Cortex 7), all being 32 bit but never on x86_64. Looks like Mongoose may be forgetting its embedded roots to me... Mongoose is

Re: Relative path does not refer to root document

2014-01-09 Thread Sergey Lyubka
On Thu, Jan 9, 2014 at 5:56 AM, Phuoc Can Hua bigboss9...@gmail.com wrote: Thank you for the update. I will check this out later because I've worked around my problem for the moment. Does that mean all existing scripts won't run on the new version? The release version has Lua functionality

Re: mongoose 5.0 not delivering index.html and no directory listing

2014-01-10 Thread Sergey Lyubka
Could you try this version please: https://mongoose.googlecode.com/files/mongoose-lua-sqlite-ssl.10.01.2014.exe I suspect the problem is unicode characters in the path to document root. On Fri, Jan 10, 2014 at 11:37 AM, Mapel micap...@gmail.com wrote: Hey, searched the net, but found

Re: using SSI tag to send client locale datetime to server

2014-01-10 Thread Sergey Lyubka
You want to pass an information (current time) from client to server, the best way it to pass it in URI. For example, using curl, you can do: curl http://my_server/foo?my_info=bar Did I understand you correctly? SSI support has been removed since 5.0, the reason is that mongoose has way more

Re: Mongoose displays source when running test.lp

2014-01-15 Thread Sergey Lyubka
to compile it to get a Lua + SQLite binary On Tuesday, January 14, 2014 6:54:21 PM UTC+1, Sergey Lyubka wrote: Please make sure you're using the latest release. On Tue, Jan 14, 2014 at 5:10 PM, Gilles frdt...@gmail.com wrote: Hello I followed the example http://cesanta.com/#docs,LuaSqlite.md

Re: Where does the file Saves when i Upload

2014-01-16 Thread Sergey Lyubka
Mongoose buffers POST data before it calls the callback, calling realloc() repeatedly to get more memory. If the file is big, realloc() fails. You can use -DUSE_POST_SIZE_LIMIT=X to limit POST site (documented at http://cesanta.com/#docs,Embed.md) When successful, mongoose passes POST contents to

Re: Where does the file Saves when i Upload

2014-01-17 Thread Sergey Lyubka
Thinking about large POST buffers, I've just got another idea. Mongoose can spool POST requests to temporary files, but instead of passing a FILE * pointer, it can memory map the file and give a memory address as if it was malloc-ed. This way, the API wouldn't change at all, and existing

Re: Where did the Visual Studio project files go?

2014-01-26 Thread Sergey Lyubka
On Sun, Jan 26, 2014 at 9:52 PM, term...@gmail.com wrote: Where did the Visual Studio project files go? Am I correct that server.c is what I build to make a mongoose.exe? Thanks Correct, server.c is the source for the stand-alone executable. -- You received this message because you are

Mongoose 5.2 is released

2014-02-01 Thread Sergey Lyubka
Hi mongoose-users, This is an announcement of 5.2 release. In this release: o Windows binary made fully UNICODE aware. In previous versions, the presence of non-ASCII chars in document root, CGI script name, or directory name might have broken Mongoose as stand-alone or as

Re: Windows (8), security (acl, passwds)

2014-02-14 Thread Sergey Lyubka
On Fri, Feb 14, 2014 at 5:57 PM, John Bessa john.be...@gmail.com wrote: I am running 4.1, which I downloaded last year. I recently downloaded 5.1 but I am a little gun-shy about the licensing issues. (There is no commercial use intended here though I would ~like~ there to be: schools are

Re: Mongoose+Lua+SQLite binaries

2014-02-14 Thread Sergey Lyubka
On Fri, Feb 14, 2014 at 7:40 PM, stel...@geocentral.net wrote: Thank you, Sergey. My application's intended audience are school teachers and students, many of them located in developing countries. They would appreciate pre-built Windows and Linux (including 32-bit) executables. I ended up

Re: Can please provide an example of mongoose.conf for multiple hosting?

2014-02-19 Thread Sergey Lyubka
Hi Gianluca, Currently mongoose does not support rewrites based on Host: header (i.e. domain name). That is planned in the next release, scheduled in couple of weeks time. Sergey. On Tue, Feb 18, 2014 at 11:53 PM, gianluca napolitano hfu...@gmail.comwrote: Hello I'm new to the group and

Re: asynch uri handlers (5.2/master)

2014-02-19 Thread Sergey Lyubka
|= CONN_LONG_RUNNING; } iobuf_remove(conn-ns_conn-recv_iobuf, frame_len); } On Friday, 17 January 2014 20:25:39 UTC+1, Alexander Björck wrote: Thanks for the quick work :) On Fri, Jan 17, 2014 at 5:38 PM, Sergey Lyubka vale...@gmail.com wrote: On Fri, Jan 17, 2014 at 4:33 PM

Re: MJPEG Stream with Mongoose 5.2

2014-03-04 Thread Sergey Lyubka
Andreas, from version 5.x on, Mongoose is async and non-blocking. That means that calling sleep() will block all connections. I've put together an mjpg example, https://github.com/cesanta/mongoose/blob/master/examples/mjpg.c Please let me know how it works for you. Sergey. On Thu, Feb 27, 2014

Re: Can I pass information from my C++ program to Lua Server Pages?

2014-03-06 Thread Sergey Lyubka
Hi Jurie, There is no mechanism currently that makes the modification of Lua state easy. You have to patch prepare_lua_environment(). Your suggestion to make a hook is a way to go - a new MG_LUA event could be introduced, and event handler can add whatever variables to the new Lua state. On

Re: Can I pass information from my C++ program to Lua Server Pages?

2014-03-06 Thread Sergey Lyubka
On Thu, Mar 6, 2014 at 9:50 PM, Jurie Horneman ju...@jurie.org wrote: Hi Sergey, Your suggestion to make a hook is a way to go - a new MG_LUA event could be introduced, and event handler can add whatever variables to the new Lua state. I looked into it a bit, and here is how I think one

Re: Can I pass information from my C++ program to Lua Server Pages?

2014-03-07 Thread Sergey Lyubka
for this case. On 06 Mar 2014, at 23:56 , Sergey Lyubka vale...@gmail.com wrote: On Thu, Mar 6, 2014 at 9:50 PM, Jurie Horneman ju...@jurie.org wrote: Hi Sergey, Your suggestion to make a hook is a way to go - a new MG_LUA event could be introduced, and event handler can add whatever variables

Mongoose 5.3 is released

2014-03-10 Thread Sergey Lyubka
Hi mongoose-users, Changes in 5.3 release: o Moved to the evented API. Updated API documentation is at http://cesanta.com/docs/Embed.shtml http://cesanta.com/docs/API.shtml o Added MG_LUA event for exporting custom variables to the Lua environment o Added virtual hosts

Re: Automatically open browser on localhost:8080

2014-03-10 Thread Sergey Lyubka
Create a directory structure like this: *UsbDrive/* * your_work/* * mongoose.conf* * mongoose.exe* * web_root/* * index.html* * ...* Put your web site inside *web_root* directory. Write

Re: 500 Server Error start_process(C:\mongoose/hello.cgi) failed

2014-03-11 Thread Sergey Lyubka
/body HTML exit; On Tuesday, 11 March 2014 12:25:59 UTC+5:30, Sergey Lyubka wrote: Hi Abishek, please publish the first line of hello.cgi On Tue, Mar 11, 2014 at 6:41 AM, abhisek mishra abhi...@gmail.comwrote: Hi All, I am getting the following error while running the server

Re: mongoose web server on Yocto linux distribution

2014-03-12 Thread Sergey Lyubka
On Wed, Mar 12, 2014 at 11:27 PM, rahul pendyala rhl.pendy...@gmail.comwrote: Hi Sergey Thank you for the prompt response. Are there any other web servers for embedded linux out there that I could take a look at too? Hi Rahul, Are you looking for a consultancy? Sergey. -- You received

Re: how to write a simplest http file download server?

2014-03-14 Thread Sergey Lyubka
Please take a look at the first example at http://cesanta.com/docs/Embed.shtml On Fri, Mar 14, 2014 at 4:11 AM, Lofty Cool coollo...@gmail.com wrote: file.c in examples directory out of date -- You received this message because you are subscribed to the Google Groups mongoose-users group.

Re: Automatically open browser on localhost:8080

2014-03-21 Thread Sergey Lyubka
What if mongoose binary opens a browser automatically when binary is started? On Tue, Mar 11, 2014 at 10:09 AM, Sergey Lyubka vale...@gmail.com wrote: This .bat file works for me: *start mongoose-pro-5.3.exe -document_root web_root -listening_port 1234* *start http://127.0.0.1:1234 http

Re: Removal of open_file callback

2014-03-25 Thread Sergey Lyubka
Hi Paul, How about factoring out a function that sends HTTP headers for the static file requests and expose it via API (e.g. mg_send_static_file_headers)? Then, your code would be simply like this: static int ev_handler(struct mg_connection *conn, enum mg_event ev) { if (ev == MG_REQUEST

Re: Removal of open_file callback

2014-03-25 Thread Sergey Lyubka
Re-sending garbled code example: static int ev_handler(struct mg_connection *conn, enum mg_event ev) { if (ev == MG_REQUEST is_encrypted_file(conn-uri)) { *mg_send_static_file_headers*(conn, make_path(conn-uri)); send_encrypted_file(conn); return MG_TRUE; } else if (ev ==

Re: Removal of open_file callback

2014-03-25 Thread Sergey Lyubka
On Tue, Mar 25, 2014 at 1:41 PM, Paul Dwyer dwye...@gmail.com wrote: I like the idea and I think something along those lines is probably the correct approach for this (expose through the API what is necessary to handle the files however you want but without cluttering up/adding bugs to

Re: Removal of open_file callback

2014-03-25 Thread Sergey Lyubka
On Tue, Mar 25, 2014 at 3:19 PM, Paul Dwyer dwye...@gmail.com wrote: Not sure why but my last reply failed... :(... What do you think about this approach?: 1 - Manually set Date and Content-Type (call to get_mime_type [is this safe?]) using mg_send_header 2 - Call mg_send_data with the

Re: Mangoose - websocket server, closing connection immediately. Why ?

2014-03-26 Thread Sergey Lyubka
Hi Swati, Please publish your code, otherwise it is impossible to tell what it going on. Sergey. On Wed, Mar 26, 2014 at 6:13 AM, swati joshi bjsw...@gmail.com wrote: Hi there, I am trying out the example code from mangoose5.3 version. I am facing the problem of automatic disconnection of

Re: Source missing ./build directory

2014-04-15 Thread Sergey Lyubka
$ cd examples $ make server On Tue, Apr 15, 2014 at 1:59 PM, Gilles frdthe...@gmail.com wrote: Hello I'd like to build Mongoose on Linux. I notice that both 5.4 and 5.3 are missing the ./build directory: /tmp# ll mongoose-5.3 total 180 drwxrwxr-x 4 root root 4096 Mar 10 12:21 ./

Re: server example. how to enable lua pages

2014-04-21 Thread Sergey Lyubka
Built-in Lua support has been removed from 5.4 onwards. That is the strategic decision. Server-side javascript support is coming. Please resort to either earlier version, or use LSP with CGILua ( http://keplerproject.github.io/cgilua). Sergey. On Mon, Apr 21, 2014 at 4:15 AM, Maple H.L

Re: Mongoose basic example

2014-04-27 Thread Sergey Lyubka
You need to specify document_root option, and return MG_FALSE for the files inside document_root. On Fri, Apr 25, 2014 at 8:23 PM, Gustavo Santana gustavolima...@gmail.comwrote: Hi everybody! I compiled the hello.c example but when I acess localhost:8080 I get the message: Hello! Requested

Re: mongoose server and webdav?

2014-04-28 Thread Sergey Lyubka
Hi Benjamin, did you specify dav_auth_file? Do you use curl as a dav client, or Mac's Finder, or some other client? On Mon, Apr 28, 2014 at 3:20 PM, Benjamin Khoo benk...@gmail.com wrote: hi i am trying to make use of mongoose as a webdav server on OSX. While server.c builds well and i am

Re: mongoose server and webdav?

2014-04-29 Thread Sergey Lyubka
10:22:14 PM UTC+8, Sergey Lyubka wrote: Hi Benjamin, did you specify dav_auth_file? Do you use curl as a dav client, or Mac's Finder, or some other client? On Mon, Apr 28, 2014 at 3:20 PM, Benjamin Khoo ben...@gmail.com wrote: hi i am trying to make use of mongoose as a webdav server on OSX

Re: mongoose server and webdav?

2014-04-29 Thread Sergey Lyubka
On Tue, Apr 29, 2014 at 11:03 AM, Benjamin Khoo benk...@gmail.com wrote: hi would there be any chance for it to be implemented? Sure thing. Right now, that is not on the radar though, so the only way to get it fast is to pay for the development. Otherwise, wait. Sergey. thanks --

Re: Post without redirection

2014-04-29 Thread Sergey Lyubka
Thank you Massimo! On Sun, Apr 27, 2014 at 3:28 PM, Massimo Callegari massimocallegari1...@gmail.com wrote: Ok, I think I solved by executing the POST on a separate iframe. I like to have the preview of the frame, but it can be easily hidden so users don't even know what happened in

Re: Browser should not open

2014-04-29 Thread Sergey Lyubka
Right now, it is not possible. Please file a bug, and we'll make an appropriate change. Thanks! Sergey. On Mon, Apr 28, 2014 at 3:49 AM, Benj Tupas bmatu...@gmail.com wrote: The application that I'm developing right now uses Chromium Embedded Framework to handle multiple display webapp. The

Re: html in hello.c

2014-05-02 Thread Sergey Lyubka
*static int index_html(struct mg_connection *conn) { if (strcmp(conn-uri, /) == 0) {mg_printf_data(conn, %s, !DOCTYPE html);return MG_TRUE; } return MG_FALSE; // let mongoose serve all other URIs}* ​ -- You received this message because you are subscribed to the Google Groups

Re: LibMongoose: File upload (hugh files)

2014-05-08 Thread Sergey Lyubka
Hi Marcel, when uploaded file is spooled to the filesystem, user callback should still be called, and POST content be exposed to the caller. I see two options: 1. memory-map spooled file. conn-content, conn-content_len will point to the memory mapped file in the same way as it was a usual small

Re: How to implement basic authentication

2014-05-20 Thread Sergey Lyubka
On Thu, May 15, 2014 at 11:43 AM, Sumit Aggarwal getsumit...@gmail.comwrote: Hello, i am implementing REST style server in Embedded Devices using Mongoose, which i can access from other devices. Now i want to provide security in this communication. I want to implement some thing like below.

Re: mongoose SSL server with enrypted key

2014-05-22 Thread Sergey Lyubka
No, Mongoose cannot do SSL password callback. You need to have password-less cert. On Mon, May 12, 2014 at 11:50 PM, shilpanabar shilpana...@gmail.com wrote: Hi, I am trying to start Mongoose server securely on port 443 (Mongoose 3.8). I have a encrypted certificate file and also have the

Re: How to take care of HTTP Headers in case of Content-Type “font/opentype” using mongoose

2014-05-29 Thread Sergey Lyubka
http://cesanta.com/docs/Options.shtml look for extra_mime_types *mongoose -extra_mime_types .blah=font/opentype* On Thu, May 29, 2014 at 3:24 PM, swati joshi bjsw...@gmail.com wrote: I am working on mongoose library for hosting a local webserver. I downloaded the code from

Re: MG_REQUEST with MG_MORE

2014-05-31 Thread Sergey Lyubka
On Thu, May 8, 2014 at 8:30 PM, David Bordeleau lohka...@gmail.com wrote: Hi, I'm using mongoose 5.4 and trying to process 2 requests at the same time. I quickly noticed that the 2nd request only gets processed once the 1st event is returned. Could you elaborate on that? Requests, i.e.

Re: Best practice for sending text data to browser after ajax POST when server has delay building response

2014-06-01 Thread Sergey Lyubka
On Fri, May 30, 2014 at 5:09 PM, David A. Lethe dlethe3...@gmail.com wrote: When I have a request_method POST and data is immediately available (or I know it will take less than second or so to get it), I use the standard reply header HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection:

Re: Possible bug with timeouts in ns_server_poll()

2014-06-11 Thread Sergey Lyubka
I think the problem is that ns_server_poll() sets current_time before select(), then select() waits for a long time, then last_io_time is set to current_time which is long time in the past. The fix should be to move current_time initialization after the select(). Submitted

Re: Possible bug with timeouts in ns_server_poll()

2014-06-11 Thread Sergey Lyubka
Awesome. Thanks for reporting. On Wed, Jun 11, 2014 at 10:08 AM, stiebe...@web.de wrote: On Wednesday, June 11, 2014 10:45:01 AM UTC+2, Sergey Lyubka wrote: I think the problem is that ns_server_poll() sets current_time before select(), then select() waits for a long time

Re: Interactions between keep-alive and MG_CLOSE when using mg_connection-connection_param

2014-06-12 Thread Sergey Lyubka
I've made a quick test and realized that long-lived connections are closed. Pushed https://github.com/cesanta/mongoose/commit/3cec6f6745ea9714bc77ff332072beea279bfe82 Now they're kept alive. Please verify. On Thu, Jun 12, 2014 at 10:42 AM, Sergey Lyubka vale...@gmail.com wrote: Hi Terence, I

Re: Best practice for sending text data to browser after ajax POST when server has delay building response

2014-06-12 Thread Sergey Lyubka
On Mon, Jun 2, 2014 at 7:45 AM, David A. Lethe dlethe3...@gmail.com wrote: On Jun 1, 2014, at 4:32 AM, Sergey Lyubka vale...@gmail.com wrote: On Fri, May 30, 2014 at 5:09 PM, David A. Lethe dlethe3...@gmail.com wrote: When I have a request_method POST and data is immediately available

Re: Interactions between keep-alive and MG_CLOSE when using mg_connection-connection_param

2014-06-12 Thread Sergey Lyubka
. On Thursday, June 12, 2014 2:59:34 AM UTC-7, Sergey Lyubka wrote: I've made a quick test and realized that long-lived connections are closed. Pushed https://github.com/cesanta/mongoose/commit/ 3cec6f6745ea9714bc77ff332072beea279bfe82 Now they're kept alive. Please verify. On Thu, Jun 12

Re: Interactions between keep-alive and MG_CLOSE when using mg_connection-connection_param

2014-06-12 Thread Sergey Lyubka
be allowed to be kept alive, but when it's called in close_local_endpoint(), it checks to see if the endpoint type is EP_USER or EP_FILE. On Thursday, June 12, 2014 10:25:21 AM UTC-7, Sergey Lyubka wrote: Yeah that's how connection param should be used, you're correct. Don't forget to set it back

Re: mg_printf_data() does not always send a terminating chunk?

2014-06-13 Thread Sergey Lyubka
On Fri, Jun 13, 2014 at 12:04 AM, Terence Martin walts@gmail.com wrote: I'm not sure if I've stumbled on a bug or if I'm expecting unexpected behaviour here. I have a small sample program (attached) that illustrates this problem (if it is one). It supports two different requests:

Re: mg_printf_data() does not always send a terminating chunk?

2014-06-13 Thread Sergey Lyubka
Here we go: https://github.com/cesanta/mongoose/commit/29f4703e4f14d78aeebcc81d6c3407c5efb06f12 Please confirm that mongoose logic is now consistent and expected :-) On Fri, Jun 13, 2014 at 7:54 AM, Sergey Lyubka vale...@gmail.com wrote: On Fri, Jun 13, 2014 at 12:04 AM, Terence Martin

Re: mg_printf_data() does not always send a terminating chunk?

2014-06-13 Thread Sergey Lyubka
! Now I feel a bit better for having delusional thoughts about the keep-alive handling being broken. ;) On Thursday, June 12, 2014 11:58:05 PM UTC-7, Sergey Lyubka wrote: Here we go: https://github.com/cesanta/mongoose/commit/29f4703e4f14d78aeebcc81d6c3407 c5efb06f12 Please confirm

Re: Session Management with Mongoose server

2014-06-15 Thread Sergey Lyubka
You're correct, mongoose gives you an API to manipulate HTTP headers, including Cookie header, which you can use to implement sessions support. On Sat, May 10, 2014 at 11:33 AM, paul zwerky paul.zwe...@gmail.com wrote: Hi all, I used mongoose server in successfully embedding to my

Re: Mongoose basic example

2014-06-18 Thread Sergey Lyubka
Port 80 might be busy, or privileged. On Wed, Jun 18, 2014 at 3:52 PM, Sam Kunun sam.ku...@gmail.com wrote: Hello, I try to compile example hello.c to listening port 80 by modifying this line : mg_set_option(server, listening_port, 8080); to mg_set_option(server, listening_port, 80);

Re: 4.1 default throttle?

2014-06-20 Thread Sergey Lyubka
Hi Ryan, please try the latest version and see if there's a difference. Generally, documentation for every version is on github: https://github.com/cesanta/mongoose/releases 4.1 is special though, it doesn't have doc files. On Fri, Jun 20, 2014 at 3:47 PM, Ryan Rogers beavervalleyl...@gmail.com

Re: 4.1 default throttle?

2014-06-20 Thread Sergey Lyubka
On Friday, June 20, 2014, Ryan Rogers beavervalleyl...@gmail.com wrote: Hi Sergey, We are not using Mongoose now, we are using IIS, because it is 12x faster. But we would like to start using Mongoose again if possible. I suggested to try the latest version just to see if the problem is

Re: Run Mongoose server

2014-06-23 Thread Sergey Lyubka
Make sure mongoose.c and hello.c are from the same repo revision On Jun 23, 2014 11:26 AM, Jijo Thomas jijovenniku...@gmail.com wrote: Yes, already added Mongoose.c file and mongoose.h file. Both the files and hello.c are in the same folder. On Monday, 23 June 2014 14:03:46 UTC+5:30, Sergey

Re: Run Mongoose server

2014-06-23 Thread Sergey Lyubka
and hello.c in the same folder. Now i am trying to load the server, but fails. i don't know how to solve this. Please help me. On Monday, 23 June 2014 16:02:18 UTC+5:30, Sergey Lyubka wrote: Make sure mongoose.c and hello.c are from the same repo revision On Jun 23, 2014 11:26 AM, Jijo

Re: Multiple Responses over Websockets

2014-06-26 Thread Sergey Lyubka
Terence is correct, thanks Terence. The only API call that is safe to use from another thread and which could be used to push data to multiple websocket connection is *mg_wakeup_server_ex().* On Thu, Jun 26, 2014 at 5:20 PM, Terence Martin walts@gmail.com wrote: Mongoose isn't

Re: MG_CLOSE is not invoked in error situations

2014-06-26 Thread Sergey Lyubka
On Tue, Jun 24, 2014 at 5:19 PM, Terence Martin walts@gmail.com wrote: Not a bug, but possibly a missing addendum to the documentation. The docs say that MG_CLOSE is invoked when the connection is being closed. However, in error situations (e.g. when MG_HTTP_ERROR is invoked), once the

Re: Mongoose Server and net_skeleton together

2014-06-27 Thread Sergey Lyubka
mongoose.c has net_skeleton files embedded inside, there is no need to combine them. If you want to use net skeleton API, just #include net_skeleton.h in your code. However if you still want to disable embedded net skeleton code and compile it separately, add -DNOEMBED_NET_SKELETON to your

Re: methods to set cookie

2014-06-29 Thread Sergey Lyubka
Serve static file through CGI script that sets a cookie. -- You received this message because you are subscribed to the Google Groups mongoose-users group. To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-users+unsubscr...@googlegroups.com. To post to

Re: How to set thread lock in lua script

2014-07-15 Thread Sergey Lyubka
Hi Howard, Lua support has been discontinued in favor of upcoming Javascript server-side support. But to answer your question, I believe you should look at http://lua-users.org/wiki/ThreadsTutorial On Thu, Jul 10, 2014 at 2:04 PM, Howard Cai hcai...@gmail.com wrote: I use mongoose + lua, I

Re: What happens to mg_connection* after MG_CLOSE ?

2014-07-21 Thread Sergey Lyubka
What stops you from checking the URI of the connection? static int callback1(struct mg_connection *conn, enum mg_event ev) { if (strcmp(conn-uri, /specific_uri) == 0 conn-is_websocket) { mg_websocket_printf(conn, WEBSOCKET_OPCODE_TEXT, %s, (const char *)

Mongoose 5.4 is released

2014-07-28 Thread Sergey Lyubka
Hi mongoose-users, Mongoose 5.4 has been released today. Release notes are published at http://cesanta.com/docs/ReleaseNotes.shtml Thanks to all contributors! Have a productive week, Sergey. -- You received this message because you are subscribed to the Google Groups mongoose-users group. To

Re: What happens to mg_connection* after MG_CLOSE ?

2014-07-30 Thread Sergey Lyubka
Could you shed more light on that non-working 3rd use case please? Sharing the code is probably the best way. On Thu, Jul 24, 2014 at 12:36 PM, swati joshi bjsw...@gmail.com wrote: I just got the core of the problem To Be specific, the recv() that is called from ns_server_wakeup_ex () is not

Re: What happens to mg_connection* after MG_CLOSE ?

2014-07-30 Thread Sergey Lyubka
mg_wakeup_server_ex() sends a message to the socketpair and returns immediately. Main server loop, which runs in a separate thread, reads that message, calls the callback, and sends one byte back (so that recv() unblocks) to indicate it has finished with the callback. Thus the purpose of recv()

Re: proxy.c example

2014-07-31 Thread Sergey Lyubka
clone https://github.com/cesanta/net_skeleton into the same directory where mongoose project is cloned. On Thu, Jul 31, 2014 at 5:28 PM, kk kunalkulshrestha1...@gmail.com wrote: Hello, I am trying to compile proxy.c to be able to see how mg_wakeup_server_ex works. Compiling using the

Re: Get a value from option form, in C using mongoose.

2014-08-02 Thread Sergey Lyubka
Do the same as in this example: https://github.com/cesanta/mongoose/blob/master/examples/post.c On Sat, Aug 2, 2014 at 1:03 PM, jordi jordi90 lordsanche...@gmail.com wrote: Thank you very much, i will search in those direction. 2014-08-02 13:08 GMT+02:00 chrisj194...@gmail.com: Since

Re: concurrent requests?

2014-08-08 Thread Sergey Lyubka
Mongoose releases, including 5.4, are here: https://github.com/cesanta/mongoose/releases Please read the docs as well, many things are explained there: http://cesanta.com/docs/Embed.shtml http://cesanta.com/docs/API.shtml On Fri, Aug 8, 2014 at 5:32 PM, Scott Ellis scooterel...@gmail.com wrote:

Re: What happens to mg_connection* after MG_CLOSE ?

2014-08-22 Thread Sergey Lyubka
On Fri, Aug 22, 2014 at 5:20 PM, Scott Ellis scooterel...@gmail.com wrote: Hi, I am curious, if the callback function you pass to mg_wakeup_server_ex() is called on every connection pointer that mongoose is holding, then how do you make sure the response you want to send goes to the correct

Re: concurrent requests?

2014-08-25 Thread Sergey Lyubka
On Mon, Aug 25, 2014 at 4:36 PM, Scott Ellis scooterel...@gmail.com wrote: Hi Sergey, you said: Blocking or otherwise long-running operations must be moved to dedicated threads. A callback that needs to get a result of long-running operation should schedule it, return MG_MORE -- and not block

Re: mg_write returns inconsistent length

2014-08-29 Thread Sergey Lyubka
Hi Gregory! I believe you're talking about mg_send_data() function, not mg_send(). mg_send() returns either 0 or the 3rd parameter, number of bytes mg_send_data() returns the size of output IO buffer. Both functions do not send data to the socket. mg_printf() and mg_printf_data() are the same in

Re: mg_write returns inconsistent length

2014-08-29 Thread Sergey Lyubka
just using mg_write -- which is what I used with the old version of the server without a problem. Using mg_send and mg_send_data has the same behavior. Greg On Thursday, August 28, 2014 11:02:26 PM UTC-7, Sergey Lyubka wrote: Hi Gregory! I believe you're talking about mg_send_data

Re: mg_write returns inconsistent length

2014-08-29 Thread Sergey Lyubka
Basically, if mg_write() is used, then HTTP headers must include content-length: case MG_REQUEST: mg_write(conn, HTTP/1.0 200 OK\r\n Content-Length: %d\r\n\r\n, my_len); mg_write(conn, ...); // frames. Total data len must be my_len mg_write(conn, ...);

Re: mg_write returns inconsistent length

2014-08-29 Thread Sergey Lyubka
just looped calling my getframe() which blocked until the frame is ready. On Fri, Aug 29, 2014 at 3:55 PM, Sergey Lyubka vale...@gmail.com wrote: Basically, if mg_write() is used, then HTTP headers must include content-length: case MG_REQUEST: mg_write(conn, HTTP/1.0 200 OK\r\n

Re: time complexity of save and update

2014-09-01 Thread Sergey Lyubka
Hi, On Mon, Sep 1, 2014 at 1:29 PM, Vishnu Kumar Reddy Yanala vishnu.shoppi...@gmail.com wrote: I want to push data into nested json. collection.update is efficient or collection.save The first step would be to ask on a right mailing list :-) This mailing list is dedicated to mongoose web

Re: High CPU load with file transfer

2014-09-11 Thread Sergey Lyubka
Are you using mg_send_file() ? On Thu, Sep 11, 2014 at 10:31 AM, Marcel Wirtz pyr0...@gmail.com wrote: Hi, I did some tests with the fiels example application. When serving lage files, the CPU load of the application is very high. After some research with callgrind, I located the problem in

Re: How to pass user context and how to determine whether it is a new connection?

2014-09-13 Thread Sergey Lyubka
On Sat, Sep 13, 2014 at 9:36 AM, Terence Martin walts@gmail.com wrote: It's been my experience that MG_POLL is always the first event that triggers for a new connection. I've always assumed that this is because the new connection is accepted and stored before the poll starts to walk the

Re: Accessing my own object inside ev_handler

2014-09-17 Thread Sergey Lyubka
Pass pointer to your object to the mg_create_server() function. In the even handler, it'll be mg_connection::server_param. On Wed, Sep 17, 2014 at 6:59 AM, Giridhar Addepalli giridhar1...@gmail.com wrote: Hi All, I am newbie to mongoose. I am trying to have an embedded mongoose server in my

Re: Using mongoose for heavy traffic on websocket using mg_wakeup_server

2014-09-18 Thread Sergey Lyubka
Hi Kunal, what is the $Date$ timestamp of your mongoose.c file? On Thu, Sep 18, 2014 at 12:28 AM, kk kunalkulshrestha1...@gmail.com wrote: Hi, I am working on an application in which I am using mg_wakeup_server API to push data over websocket connection. As guided for Mongoose usage, I have

Re: Using mongoose for heavy traffic on websocket using mg_wakeup_server

2014-09-18 Thread Sergey Lyubka
: ## Release 5.4, July 28 2014 How should I find date and timestmap? Regards, Kunal On Thursday, September 18, 2014 4:25:22 AM UTC-4, Sergey Lyubka wrote: Hi Kunal, what is the $Date$ timestamp of your mongoose.c file? On Thu, Sep 18, 2014 at 12:28 AM, kk kunalkulsh...@gmail.com wrote

Re: High CPU load with file transfer

2014-09-19 Thread Sergey Lyubka
by far). Am Mittwoch, 17. September 2014 09:54:11 UTC+2 schrieb Sergey Lyubka: Well if that is memcpy, then I don't find it surprising. Server is mostly doing data copying, reading from file and copying to the socket. On Sat, Sep 13, 2014 at 12:11 PM, Marcel Wirtz pyr...@gmail.com wrote

Re: how to send error code to client in case of improper request

2014-09-19 Thread Sergey Lyubka
mg_send_status(conn, HTTP_ERROR_CODE); mg_send_data(conn, , 0); return MG_TRUE; On Thu, Sep 18, 2014 at 3:22 AM, Giridhar Addepalli giridhar1...@gmail.com wrote: Hi All, I want to build a embedded http server( which serves files from local disk to clients ) in to my c++ application. I want

Re: mg_parse_multipart is slightly vague - how to read an upload to a buffer?

2014-09-24 Thread Sergey Lyubka
Hi John, Is file upload example ( https://github.com/cesanta/mongoose/blob/master/examples/file_upload/file_upload.c) helpful for your case? On Wed, Sep 24, 2014 at 3:49 AM, John Peasley fireha...@gmail.com wrote: I've got a situation where I need to be able to use mg_parse_multipart to accept

Re: Using mongoose for heavy traffic on websocket using mg_wakeup_server

2014-09-24 Thread Sergey Lyubka
the same issue i.e. high frequency data communication makes the serving thread go in blocking state. I am looking for help. Please let me know if you have any questions. Regards, Kunal On Thursday, September 18, 2014 10:57:38 AM UTC-4, Sergey Lyubka wrote: Ah, ok. Date timestamp was introduced

Re: abrupt hanging / blocking of mongoose web server

2014-09-24 Thread Sergey Lyubka
Thanks. What's the os ? On Sep 24, 2014 10:32 AM, swati joshi bjsw...@gmail.com wrote: Hi, Just to add to the problem details to the above, I have the following observations: 1. The Polling thread blocks when there are huge numbers of requests coming in Ex: 100+ in a sec. Also, for each

Re: Mongoose picks wrong network when VMware Player is installed, and I can't change that?

2014-09-24 Thread Sergey Lyubka
You can set listening_port option to IP:PORT, where IP is the IP of the interface you'd like to bind to. On Wed, Sep 24, 2014 at 4:01 PM, Maarten Bijster maarten.bijster.authentic...@gmail.com wrote: Dear all, I've VMware Player on my Windows 8.1 system. When I start Mongoose, it picks a

Re: Chat.c example

2014-10-05 Thread Sergey Lyubka
chat.c has been removed. You can take a look at the older releases for the reference: https://github.com/cesanta/mongoose/blob/5.0/examples/chat.c We'll add a separate example for cookie-based auth soon. On Sun, Oct 5, 2014 at 12:08 PM, Carlos Tangerino carlos.tanger...@gmail.com wrote: The

Re: Chat.c example

2014-10-08 Thread Sergey Lyubka
will decide if he can do or not, so maybe showing an error message and redirecting him to the login page. Thanks On Sunday, October 5, 2014 6:28:41 PM UTC+2, Sergey Lyubka wrote: chat.c has been removed. You can take a look at the older releases for the reference: https://github.com/cesanta

Re: Behavior when client presses Control-C (^C) before request completes

2014-10-09 Thread Sergey Lyubka
Hi Puneet, On step 4, an old connection got MG_CLOSE. That's expected. Every connection gets MG_POLL if it takes more then one mg_poll_server() cycles to serve it. That is also expected. My understanding is that you do not see MG_REQUEST for the new connections. Is that correct? On Tue, Oct 7,

Re: Chat.c example

2014-10-09 Thread Sergey Lyubka
https://github.com/cesanta/mongoose/tree/master/examples/cookie_authentication On Wed, Oct 8, 2014 at 10:27 PM, jordi jordi90 lordsanche...@gmail.com wrote: Could you put and example pls!! It would be really usefull!! 2014-10-08 23:07 GMT+02:00 Sergey Lyubka vale...@gmail.com: Is restful

Re: past upload code

2014-10-15 Thread Sergey Lyubka
Github stores all the previous versions of the code - you can easily find anything yourself. I am surprised though you can't upload tar files - can you elaborate what the problem is please? On Tue, Oct 14, 2014 at 6:28 PM, lordsanche...@gmail.com wrote: Hi Sergey, a few months ago I started a

Re: Assignment

2014-10-15 Thread Sergey Lyubka
Hi Archit, could you elaborate what exactly did you try to build a server? Also, I am curious what college you're attending that gives assignments based on mongoose? Thanks On Tue, Oct 14, 2014 at 10:23 PM, Archit Garg architgarg1...@gmail.com wrote: yeah i am in serious need of help ..

  1   2   >