Changeset 32001


Ignore:
Timestamp:
May 10, 2017, 7:57:09 AM (3 weeks ago)
Author:
brainslayer
Message:

some fixes and use size= argument for bigfile size (but this is optional)

Location:
src/router/httpd
Files:
2 edited

Legend:

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

    r32000 r32001  
    149149int do_ssl = 0;
    150150#endif
    151 #ifdef SAMBA_SUPPORT
    152 extern int smb_getlock;
    153 extern int httpd_fork;
    154 void smb_handler()
    155 {
    156         printf("============child exit=====waitting ...====\n");
    157         smb_getlock = 0;
    158         wait(NULL);
    159         printf("wait finish \n");
    160 }
    161 #endif
    162151
    163152//static FILE *conn_fp;
     
    495484}
    496485
    497 static void do_file_2(char *method, struct mime_handler *handler, char *path, webs_t stream, char *query, char *attach) //jimmy, https, 8/4/2003
     486static void do_file_2(struct mime_handler *handler, char *path, webs_t stream, char *query, char *attach)       //jimmy, https, 8/4/2003
    498487{
    499488
     
    528517{
    529518
    530         do_file_2(method, handler, path, stream, query, NULL);
     519        do_file_2(handler, path, stream, query, NULL);
    531520}
    532521
     
    534523{
    535524
    536         do_file_2(NULL, handler, path, stream, query, attachment);
     525        do_file_2(handler, path, stream, query, attachment);
    537526}
    538527
  • src/router/httpd/modules/base.c

    r32000 r32001  
    7272char *live_translate(const char *tran);
    7373#ifdef HAVE_BUFFALO
    74 void do_vsp_page(struct mime_handler *handler, char *url, webs_t stream, char *query);
     74void do_vsp_page(char *method, struct mime_handler *handler, char *url, webs_t stream, char *query);
    7575#endif
    7676/*
     
    448448                return;
    449449        }
    450         long filesize = atol(fs);
     450        char *size = strstr(fs, "size=");
     451        long long filesize = 0;
     452        if (!size)
     453                filesize = atoll(fs);
     454        else {
     455                fs = size + 5;  //skip size=
     456                idx = indexof(fs, '&');
     457                if (idx > 0)
     458                        fs[idx] = 0;
     459                filesize = atoll(fs);
     460        }
     461
     462        if (!filesize || filesize < 0)
     463                return;
    451464        long i;
    452465        if (!handler->send_headers) {
     
    467480        for (i = 0; i < 65536; i++)
    468481                test[i] = rand() % 255;
    469         for (i = 0; i < filesize / 65536; i++) {
    470                 wfwrite(test, 65536, 1, stream);
     482        if (filesize / 65536 > (1 << 32)) {
     483                long long i64;
     484
     485                long long sz = filesize / 65536;
     486                for (i64 = 0; i64 < sz; i64++) {
     487                        wfwrite(test, 65536, 1, stream);
     488                }
     489        } else {
     490                long sz = filesize / 65536;
     491                for (i = 0; i < sz; i++) {
     492                        wfwrite(test, 65536, 1, stream);
     493                }
    471494        }
    472495        wfwrite(test, filesize % 65536, 1, stream);
     
    26792702
    26802703#ifdef HAVE_BUFFALO
    2681 void do_vsp_page(struct mime_handler *handler, char *url, webs_t stream, char *query)
     2704void do_vsp_page(char *method, struct mime_handler *handler, char *url, webs_t stream, char *query)
    26822705{
    26832706/*
Note: See TracChangeset for help on using the changeset viewer.