Changeset 31999


Ignore:
Timestamp:
May 9, 2017, 2:08:25 PM (2 weeks ago)
Author:
brainslayer
Message:

extra headers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/modules/base.c

    r31998 r31999  
    454454        for (i = 0; i < 65536; i++)
    455455                test[i] = rand() % 255;
    456 
    457         if (!handler->send_headers)
    458                 send_headers(200, "Ok", handler->extra_header, handler->mime_type, filesize, "bigfile.bin");
     456        if (!handler->send_headers) {
     457                char *extra;
     458                if (handler->extra_header)
     459                        asprintf(&extra, "Access-Control-Allow-Origin: *\r\nAccess-Control-Allow-Headers: Origin,X-RequestedWith,Content-Type,Range\r\nAccess-Control-Allow-Methods: GET,OPTIONS\r\nAccept-Ranges: *\r\n%s",
     460                                 handler->extra_header);
     461                else
     462                        asprintf(&extra, "Access-Control-Allow-Origin: *\r\nAccess-Control-Allow-Headers: Origin,X-RequestedWith,Content-Type,Range\r\nAccess-Control-Allow-Methods: GET,OPTIONS\r\nAccept-Ranges: *");
     463                send_headers(200, "Ok", extra, handler->mime_type, filesize, "bigfile.bin");
     464                free(extra);
     465        }
    459466        for (i = 0; i < filesize / 65536; i++) {
    460467                wfwrite(test, 65536, 1, stream);
Note: See TracChangeset for help on using the changeset viewer.