Re: [Dclib-devel] DClib - http server - downloading files
Brought to you by:
davisking
From: Davis K. <dav...@us...> - 2008-11-27 13:42:17
|
It is currently hard coded to 200. If you look at the code in dlib/server/server_http_1.h line 312 you can see where it is. You could just add another argument to the on_request() callback that lets you set it to something else. Or add some variable with thread local storage and a function that lets you set it to the return code you want, that might be better since on_request() is getting to be sort of long. Either of these should be easy to do, but feel free to bother me if you still have any troubles :) Cheers, Davis 2008/11/27 Martin Slováček <ma...@ce...> > Davvis, thanks for the tip, > finally I got it working. I have another (probably the last) question - how > do I change the HTTP status code of the respnse? I tried this > > string key=""; > string value="HTTP/1.0 404 Not Found"; > response_headers.add(key,value); > > > but to no avail. If you could give me any advice, I'd appreciate that. > > Thanks in advance, > > Martin Slovacek > > > On 26.11.2008 22:07, Davis King wrote: > > > > On Wed, Nov 26, 2008 at 1:49 PM, Martin Slováček <ma...@ce...> wrote: > >> Hi Davis, >> >> For my diploma thesis, I need to embed a HTTP server to a VST plug-ins >> host, which will be cotrolled by a Java applet. So, I need to be able to >> handle a request for a binary file (java *.class file). Is there a way >> how to do it using the http server object in your library? >> >> > I haven't done this myself but I think you should be able to send a file > back through HTTP if you put the file data in the response string and set > the appropriate HTTP headers. If I recall correctly all you need to do is > set the Content-Type header to something like application/class or whatever > the appropriate content type is for general binary data or java class files. > > > -Davis > > > |