Giter Site home page Giter Site logo

Comments (4)

troglobit avatar troglobit commented on May 25, 2024 1

You can have a look at send_mime(), it is called from httpd_start_request(). Good luck!

merecat/src/libhttpd.c

Lines 753 to 755 in 606774e

static void
send_mime(struct http_conn *hc, int status, char *title, char *encodings,
const char *extraheads, const char *type, off_t length, time_t mod)

from merecat.

thenoobtester avatar thenoobtester commented on May 25, 2024 1

As a quick follow-up. I added the following line to the send_mime() function from the merecat/src/libhttpd.c file you mentionned:

"Access-Control-Allow-Origin: *\r\n",

Before:

			 "Last-Modified: %s\r\n"
			 "Accept-Ranges: bytes\r\n",
			 hc->protocol, status, title, nowbuf, EXPOSED_SERVER_SOFTWARE, modbuf);

After:

			 "Last-Modified: %s\r\n"
			 "Accept-Ranges: bytes\r\n"
			 "Access-Control-Allow-Origin: *\r\n",
			 hc->protocol, status, title, nowbuf, EXPOSED_SERVER_SOFTWARE, modbuf);

It now adds the Access-Control-Allow-Origin: * header to every response, so ideally I would add it as a configurable parameter with a regex to target specific files (like they did here on another project monkey/monkey@d4d4dab) and choose if I allow any origin with * or be more specific. But that's for later as I'm no pro programmer and C is hard.

Thank you for your help and directing me in the right direction.

from merecat.

thenoobtester avatar thenoobtester commented on May 25, 2024

Thank you for the quick response. To make sure i understand your response, do you mean it cannot be done out-of-the-box and that I should modify the source code? If that's the case then I'm afraid it's out of my skills :( I was hoping there would be an option or something.

Thank you

from merecat.

troglobit avatar troglobit commented on May 25, 2024

Correct, you need to patch the code.

from merecat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.