{"action":"created","issue":{"url":"https://api.github.com/repos/civetweb/civetweb/issues/637","repository_url":"https://api.github.com/repos/civetweb/civetweb","labels_url":"https://api.github.com/repos/civetweb/civetweb/issues/637/labels{/name}","comments_url":"https://api.github.com/repos/civetweb/civetweb/issues/637/comments","events_url":"https://api.github.com/repos/civetweb/civetweb/issues/637/events","html_url":"https://github.com/civetweb/civetweb/issues/637","id":334329227,"node_id":"MDU6SXNzdWUzMzQzMjkyMjc=","number":637,"title":"mg_send ","user":{"login":"idle-PB","id":21273630,"node_id":"MDQ6VXNlcjIxMjczNjMw","avatar_url":"https://avatars0.githubusercontent.com/u/21273630?v=4","gravatar_id":"","url":"https://api.github.com/users/idle-PB","html_url":"https://github.com/idle-PB","followers_url":"https://api.github.com/users/idle-PB/followers","following_url":"https://api.github.com/users/idle-PB/following{/other_user}","gists_url":"https://api.github.com/users/idle-PB/gists{/gist_id}","starred_url":"https://api.github.com/users/idle-PB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idle-PB/subscriptions","organizations_url":"https://api.github.com/users/idle-PB/orgs","repos_url":"https://api.github.com/users/idle-PB/repos","events_url":"https://api.github.com/users/idle-PB/events{/privacy}","received_events_url":"https://api.github.com/users/idle-PB/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-21T04:00:41Z","updated_at":"2018-06-22T00:04:43Z","closed_at":"2018-06-22T00:04:43Z","author_association":"NONE","body":"I've been asked to do a demo of serving files from memory and I'm trying to use a handler to catch all requests to the root of the site as mg_set_request_handler(ctx,\"/\",@Default_handler(),0) which works fine  but when it comes to sending the data something is going wrong and the browser is only getting the data part way into the buffer, I'm a little confused.  I'm setting the header content to match the mime type of the requested files  \r\n*header = Ascii(\"HTTP/1.1 200 OK\" + #CRLF$ + \"Content-Type: \" + content + #CRLF$ +\"Connection: close\" + #CRLF$) \r\n\r\nthen \r\n mg_lock_context(ctx)         \r\n mg_write(ctx,*header,len);\r\n  *output = pack\\CatchFile(file)  ; //gets the decompressed file from the zip pack in a data section    \r\n   Debug PeekS(*output,80,#PB_UTF8)  ;//Just for sanity to see that I,ve got the data from the start \r\n   len = pack\\getfilesize(filenum)\r\n   slen = mg_Write(ctx,*output,len)    ;//check that len slen match and that there was no error       \r\n  mg_unlock_context(ctx)             \r\n\r\nmg_write is sending the whole buffer but the browser is only getting it from part way in the file?  Even using a critical section in the function to force serialization and creating an instance of the pack object in the function is still resulting in the browser not getting the right data.  The packs *output is allocated on the heap and the contents copied to it, it's not getting overwritten or clobbered, So I can only assume that somethings going on with mg_send or I'm trying to send to much data.  \r\nI've built Civertweb v1.10 as an x86 dll and ported the embedded_c example which works fine. There are no errors that I can see.  Any Idea's? or should I try another approach.   \r\n    "},"comment":{"url":"https://api.github.com/repos/civetweb/civetweb/issues/comments/399280171","html_url":"https://github.com/civetweb/civetweb/issues/637#issuecomment-399280171","issue_url":"https://api.github.com/repos/civetweb/civetweb/issues/637","id":399280171,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTI4MDE3MQ==","user":{"login":"idle-PB","id":21273630,"node_id":"MDQ6VXNlcjIxMjczNjMw","avatar_url":"https://avatars0.githubusercontent.com/u/21273630?v=4","gravatar_id":"","url":"https://api.github.com/users/idle-PB","html_url":"https://github.com/idle-PB","followers_url":"https://api.github.com/users/idle-PB/followers","following_url":"https://api.github.com/users/idle-PB/following{/other_user}","gists_url":"https://api.github.com/users/idle-PB/gists{/gist_id}","starred_url":"https://api.github.com/users/idle-PB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idle-PB/subscriptions","organizations_url":"https://api.github.com/users/idle-PB/orgs","repos_url":"https://api.github.com/users/idle-PB/repos","events_url":"https://api.github.com/users/idle-PB/events{/privacy}","received_events_url":"https://api.github.com/users/idle-PB/received_events","type":"User","site_admin":false},"created_at":"2018-06-22T00:04:43Z","updated_at":"2018-06-22T00:04:43Z","author_association":"NONE","body":"Hi Bel, thanks I will update to 1.11 after I've sorted it out. I thought I didn't need to specify content-length, Specifying it, did indeed make the difference. The language is purebasic so yes it might look like pseudo code though I only posted the relevant lines.                     "}}
{"actor":{"display_login":"idle-PB"}}