Unnamed Fossil Project

Check-in [0015af0883]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:updated version
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:0015af08838873f5bdf2cf527b070328036eb51f
User & Date: monster 2012-09-24 08:39:46
Context
2012-09-24
08:39
updated version Leaf check-in: 0015af0883 user: monster tags: trunk
2012-09-01
16:12
fixes check-in: 1c2ae75e99 user: monster tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bigint.hc.

741
742
743
744
745
746
747




748
749
750
751
752
753
754



755
756
757
758
759
760
761
762
763
764

765
766
767
768
769
770
771
772
773
774
775
776



777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801



802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
      }
    if ( rem ) *rem = (halflong_t)Q;
    return bint;
  }
#endif
  ;





YO_BIGINT *Bigint_Decode_2(char *S)
#ifdef _YO_BINGINT_BUILTIN
  {
    YO_BIGINT *bint = Bigint_Init(0);
    char *p = S;
    
    __Auto_Ptr(bint)



      if ( p )
        {
          for ( ;*p; ++p )
            {
              if ( *p != '0' && *p != '1' ) __Raise_Format(YO_ERROR_ILLFORMED,("invalid binary number %s",S));
              bint = Bigint_Lshift_1(bint);
              bint->value[0] |= (byte_t)(*p-'0');
            }
        }
    

    return bint;
  }
#endif
  ;

YO_BIGINT *Bigint_Decode_10(char *S)
#ifdef _YO_BINGINT_BUILTIN
  {
    YO_BIGINT *bint = Bigint_Init(0);
    char *p = S;
    
    __Auto_Ptr(bint)



      if ( p )
        {
          if ( *p == '-' ) { bint->sign = -1; ++p; }
          else if ( *p == '+' ) ++p;
          
          for ( ;*p; ++p )
            {
              if ( !Isdigit(*p) ) __Raise_Format(YO_ERROR_ILLFORMED,("invalid decimal number %s",S));
              bint = Bigint_Mul_Short(bint,10);
              bint = Bigint_Add_Short(bint,*p-'0');
            }
        }
    
    return bint;
  }
#endif
  ;

YO_BIGINT *Bigint_Decode_16(char *S)
#ifdef _YO_BINGINT_BUILTIN
  {
    YO_BIGINT *bint = Bigint_Init(0);
    char *p = S;
    
    __Auto_Ptr(bint)



      if ( p )
        {
          for ( ;*p; ++p )
            {
              if ( !Isxdigit(*p) || !Isxdigit(p[1]) ) 
                __Raise_Format(YO_ERROR_ILLFORMED,("invalid hexadecimal number %s",S));
              bint = Bigint_Lshift(bint,8);
              bint->value[0] |= Str_Unhex_Byte(p,0,0);
              ++p;
            }
        }
    
    return bint;
  }
#endif
  ;

char *Bigint_Encode_2(YO_BIGINT *bint)
#ifdef _YO_BINGINT_BUILTIN







>
>
>
>
|


<



>
>
>
|
|
|
|
|
|
|
|
|
|
>





|


<



>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|




|
|


<



>
>
>
|
|
|
|
|
|
|
|
|
|
|
|







741
742
743
744
745
746
747
748
749
750
751
752
753
754

755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779

780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806

807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
      }
    if ( rem ) *rem = (halflong_t)Q;
    return bint;
  }
#endif
  ;

#define Bigint_Decode_10(S) Bigint_Decode_10_Into(0,S)
#define Bigint_Decode_16(S) Bigint_Decode_16_Into(0,S)
#define Bigint_Decode_2(S)  Bigint_Decode_2_Into(0,S)

YO_BIGINT *Bigint_Decode_2_Into(YO_BIGINT *bint, char *S)
#ifdef _YO_BINGINT_BUILTIN
  {

    char *p = S;
    
    __Auto_Ptr(bint)
      {
        if ( !bint ) bint = Bigint_Init(0);

        if ( p )
          {
            for ( ;*p; ++p )
              {
                if ( *p != '0' && *p != '1' ) __Raise_Format(YO_ERROR_ILLFORMED,("invalid binary number %s",S));
                bint = Bigint_Lshift_1(bint);
                bint->value[0] |= (byte_t)(*p-'0');
              }
          }
      }
          
    return bint;
  }
#endif
  ;

YO_BIGINT *Bigint_Decode_10_Into(YO_BIGINT *bint, char *S)
#ifdef _YO_BINGINT_BUILTIN
  {

    char *p = S;
    
    __Auto_Ptr(bint)
      {
        if ( !bint ) bint = Bigint_Init(0);

        if ( p )
          {
            if ( *p == '-' ) { bint->sign = -1; ++p; }
            else if ( *p == '+' ) ++p;
            
            for ( ;*p; ++p )
              {
                if ( !Isdigit(*p) ) __Raise_Format(YO_ERROR_ILLFORMED,("invalid decimal number %s",S));
                bint = Bigint_Mul_Short(bint,10);
                bint = Bigint_Add_Short(bint,*p-'0');
              }
          }
      }    
    return bint;
  }
#endif
  ;
  
YO_BIGINT *Bigint_Decode_16_Into(YO_BIGINT *bint, char *S)
#ifdef _YO_BINGINT_BUILTIN
  {

    char *p = S;
    
    __Auto_Ptr(bint)
      {
        if ( !bint ) bint = Bigint_Init(0);

        if ( p )
          {
            for ( ;*p; ++p )
              {
                if ( !Isxdigit(*p) || !Isxdigit(p[1]) ) 
                  __Raise_Format(YO_ERROR_ILLFORMED,("invalid hexadecimal number %s",S));
                bint = Bigint_Lshift(bint,8);
                bint->value[0] |= Str_Unhex_Byte(p,0,0);
                ++p;
              }
          }
      }    
    return bint;
  }
#endif
  ;

char *Bigint_Encode_2(YO_BIGINT *bint)
#ifdef _YO_BINGINT_BUILTIN

Changes to cgi.hc.

49
50
51
52
53
54
55

56
57
58
59
60
61
62
...
928
929
930
931
932
933
934



























935
936
937
938
#include "yoyo.hc"
#include "string.hc"
#include "buffer.hc"
#include "stdf.hc" 
#include "mime.hc"
#include "xdata.hc"
#include "xdef.hc"

#include "logout.hc"

#ifdef _LIBYOYO
#define _YO_CGI_BUILTIN
#endif

extern char **environ;
................................................................................
      }
      
    if ( cgi->ostrm ) 
      Oj_Flush(cgi->ostrm);
    else 
      fflush(stdout);
  }



























#endif
  ;

#endif /* C_once_C02CA609_3FE5_45AB_B64B_15A73FD72214 */







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
#include "yoyo.hc"
#include "string.hc"
#include "buffer.hc"
#include "stdf.hc" 
#include "mime.hc"
#include "xdata.hc"
#include "xdef.hc"
#include "xjson.hc"
#include "logout.hc"

#ifdef _LIBYOYO
#define _YO_CGI_BUILTIN
#endif

extern char **environ;
................................................................................
      }
      
    if ( cgi->ostrm ) 
      Oj_Flush(cgi->ostrm);
    else 
      fflush(stdout);
  }
#endif
  ;

void Cgi_JQ_Json(YO_CGI *cgi, YO_XNODE *n)
#ifdef _YO_CGI_BUILTIN
  {
    char *jq = Xnode_Value_Get_Str(cgi->params,"jsoncallback",0);
    if ( jq )
      {
        Buffer_Append(cgi->out,jq,-1); 
        Buffer_Append(cgi->out,"(",1);
      }
    Json_Format_Into(cgi->out,n,0);
    if ( jq )
      {
        Buffer_Append(cgi->out,")",1);
      }
  }
#endif
  ;
  
void Cgi_Json_Out(YO_CGI *cgi, YO_XNODE *n)
#ifdef _YO_CGI_BUILTIN
  {
    Cgi_JQ_Json(cgi,n);
    Cgi_Write_Out(cgi,CGI_OUT_TEXTJSON);
  }
#endif
  ;

#endif /* C_once_C02CA609_3FE5_45AB_B64B_15A73FD72214 */

Changes to crc.hc.

47
48
49
50
51
52
53

54
55
56
57
58
59
60
#define C_once_A1549AAE_F443_4982_AFD4_F5BE02C14DE6

#ifdef _LIBYOYO
#define _YO_CRC_BUILTIN
#endif

#include "yoyo.hc"


#ifdef _YO_CRC_BUILTIN
# define _YO_CRC_BUILTIN_CODE(Code) Code
# define _YO_CRC_EXTERN 
#else
# define _YO_CRC_BUILTIN_CODE(Code)
# define _YO_CRC_EXTERN extern 







>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#define C_once_A1549AAE_F443_4982_AFD4_F5BE02C14DE6

#ifdef _LIBYOYO
#define _YO_CRC_BUILTIN
#endif

#include "yoyo.hc"
#include "string.hc"

#ifdef _YO_CRC_BUILTIN
# define _YO_CRC_BUILTIN_CODE(Code) Code
# define _YO_CRC_EXTERN 
#else
# define _YO_CRC_BUILTIN_CODE(Code)
# define _YO_CRC_EXTERN extern 

Changes to datetime.hc.

68
69
70
71
72
73
74



75

76
77
78
79
80
81
82
...
184
185
186
187
188
189
190




191

192
193
194
195
196
197
198
  #ifdef __windoze
    SYSTEMTIME systime = {0};
    FILETIME   ftime;
    quad_t Q;
    GetSystemTime(&systime);
    SystemTimeToFileTime(&systime,&ftime);
    Q = ((quad_t)ftime.dwHighDateTime << 32) + (quad_t)ftime.dwLowDateTime;



    Q -= 116444736000000000LL; /* posix epoche */

    return Q/10;
  #else
    struct timeval tv = {0};
    gettimeofday(&tv,0);
    return  ( (quad_t)tv.tv_sec * 1000*1000 + (quad_t)tv.tv_usec );
  #endif
  }
................................................................................
#endif
  ;

#ifdef __windoze
  void Timet_To_Filetime(time_t t, FILETIME *pft)
# ifdef _YO_DATETIME_BUILTIN
    {




      quad_t ll = (quad_t)t * 10000000 + 116444736000000000LL;

      pft->dwLowDateTime = (DWORD)ll;
      pft->dwHighDateTime = (DWORD)(ll >> 32);
    }
# endif
    ;
  #define Timet_To_Largetime(T,Li) Timet_To_Filetime(T,(FILETIME*)(Li))
#endif /*__windoze*/







>
>
>

>







 







>
>
>
>

>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
  #ifdef __windoze
    SYSTEMTIME systime = {0};
    FILETIME   ftime;
    quad_t Q;
    GetSystemTime(&systime);
    SystemTimeToFileTime(&systime,&ftime);
    Q = ((quad_t)ftime.dwHighDateTime << 32) + (quad_t)ftime.dwLowDateTime;
  #if defined _MSC_VER && _MSC_VER < 1300
    { quad_t QQ = 116444736; QQ *= 1000000000; Q -= QQ; }
  #else
    Q -= 116444736000000000LL; /* posix epoche */
  #endif
    return Q/10;
  #else
    struct timeval tv = {0};
    gettimeofday(&tv,0);
    return  ( (quad_t)tv.tv_sec * 1000*1000 + (quad_t)tv.tv_usec );
  #endif
  }
................................................................................
#endif
  ;

#ifdef __windoze
  void Timet_To_Filetime(time_t t, FILETIME *pft)
# ifdef _YO_DATETIME_BUILTIN
    {
  #if defined _MSC_VER && _MSC_VER < 1300
      quad_t QQ = 116444736;
      quad_t ll = (quad_t)t * 10000000 + QQ * 1000000000;
  #else
      quad_t ll = (quad_t)t * 10000000 + 116444736000000000LL;
  #endif
      pft->dwLowDateTime = (DWORD)ll;
      pft->dwHighDateTime = (DWORD)(ll >> 32);
    }
# endif
    ;
  #define Timet_To_Largetime(T,Li) Timet_To_Filetime(T,(FILETIME*)(Li))
#endif /*__windoze*/

Changes to file.hc.

1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
....
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
    if ( Raise_If_Cfile_Is_Not_Opened(f) )
      {
        YO_BUFFER *L;
        quad_t len = Cfile_Available(f);
        if ( len > INT_MAX )
          Yo_Raise(YO_ERROR_IO,
            "file to big to be read in one pass",__Yo_FILE__,__LINE__);
        L = Buffer_Reserve(0,len);
        while ( len ) 
          /* windoze text mode reads less then available, so we need to read carefully*/
          {
            Buffer_Grow_Reserve(L,L->count+(int)len);
            L->count += Cfile_Read(f,L->at+L->count,(int)len,0);
            L->at[L->count] = 0;
            len = Cfile_Available(f);
................................................................................
#endif
  ;

quad_t Buffer_File_Truncate(YO_BUFFER_FILE *f, quad_t len)
#ifdef _YO_FILE_BUILTIN
  {
    if ( len >= 0 && len < f->bf->count ) 
      Buffer_Resize(f->bf,len);
    return f->bf->count;
  }
#endif
  ;

void *Buffer_As_File(YO_BUFFER *bf)
#ifdef _YO_FILE_BUILTIN







|







 







|







1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
....
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
    if ( Raise_If_Cfile_Is_Not_Opened(f) )
      {
        YO_BUFFER *L;
        quad_t len = Cfile_Available(f);
        if ( len > INT_MAX )
          Yo_Raise(YO_ERROR_IO,
            "file to big to be read in one pass",__Yo_FILE__,__LINE__);
        L = Buffer_Reserve(0,(int)len);
        while ( len ) 
          /* windoze text mode reads less then available, so we need to read carefully*/
          {
            Buffer_Grow_Reserve(L,L->count+(int)len);
            L->count += Cfile_Read(f,L->at+L->count,(int)len,0);
            L->at[L->count] = 0;
            len = Cfile_Available(f);
................................................................................
#endif
  ;

quad_t Buffer_File_Truncate(YO_BUFFER_FILE *f, quad_t len)
#ifdef _YO_FILE_BUILTIN
  {
    if ( len >= 0 && len < f->bf->count ) 
      Buffer_Resize(f->bf,(int)len);
    return f->bf->count;
  }
#endif
  ;

void *Buffer_As_File(YO_BUFFER *bf)
#ifdef _YO_FILE_BUILTIN

Changes to tcpip.hc.

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  {
    memset(addr,0,sizeof(*addr));
    #ifdef _IPV6
    if ( !memcmp( ip->e6, "\xff\xff\0\0\0\0\0\0\0\0\0\0", 12) )
      {
    #endif
        addr->addr4.sin_family = AF_INET;
        addr->addr4.sin_port   = htons(port);
        addr->addr4.sin_addr.s_addr = ip->v4;
        *addr_len = sizeof(addr->addr4);
    #ifdef _IPV6
      }
    else
      {
        addr->addr6.sin6_family = AF_INET6;







|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  {
    memset(addr,0,sizeof(*addr));
    #ifdef _IPV6
    if ( !memcmp( ip->e6, "\xff\xff\0\0\0\0\0\0\0\0\0\0", 12) )
      {
    #endif
        addr->addr4.sin_family = AF_INET;
        addr->addr4.sin_port   = htons((ushort_t)port);
        addr->addr4.sin_addr.s_addr = ip->v4;
        *addr_len = sizeof(addr->addr4);
    #ifdef _IPV6
      }
    else
      {
        addr->addr6.sin6_family = AF_INET6;

Changes to tests/cgi.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "../prog.hc"
#include "../tesuite.hc"

void test_cgi_simple(YO_CGI *cgi)
  {
    quad_t cid = Tesuite_Case("CGI: test simple");
    Cgi_Append(cgi,"SIMPLE",-1);
    Cgi_Write_Out(cgi,YO_CGI_OUT_TEXTHTML);
    Tesuite_Case_Successed_Id(cid);
  }

void test_cgi(YO_CGI *cgi)
  {
    __Auto_Release
      {
................................................................................
        char *test;
        cgi = Cgi_Query_Params(cgi,0,0);
        
        test = Xnode_Value_Get_Str(cgi->params,"test",0);
        if ( !test )
          {
            Cgi_Append(cgi,"ERROR",-1);
            Cgi_Write_Out(cgi,YO_CGI_OUT_TEXTHTML);
          }
        else if ( !strcmp_I(test,"simple") )
          test_cgi_simple(cgi); 
      }
  }

void hosted_test_cgi(YO_WEBHOST_CGIST *st, int error)
................................................................................
        YO_WEBHOST *webhost = Webhost_Init();
        YO_HTTPD *httpd = Httpd_Server(Webhost_Callback,webhost);

        if ( Prog_Has_Opt("hosted") )
          Webhost_Register_Service(webhost,"/cgi",hosted_test_cgi,0);        
        
        Webhost_Set_Exec_Root(webhost,Prog_Directory());
        Httpd_Listen(httpd,"127.0.0.1",9123);        
        http_status = Httpx_Get(0,"http://localhost:9123/cgi?test=simple",0,Buffer_As_File(bf),0);
        Httpd_Shutdown(httpd);
        while ( Tasque_Perform_Update(0,0) ) ;
        if ( http_status != 200 || !bf->count || !!strcmp(bf->at,"SIMPLE") )
          __Raise_Format(YO_ERROR_TESUITE_FAIL,("response: %d, %s",http_status,(!bf->at?"<null>":(char*)bf->at)));
      }
    Tesuite_Case_Successed_Id(cid);







|







 







|







 







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "../prog.hc"
#include "../tesuite.hc"

void test_cgi_simple(YO_CGI *cgi)
  {
    quad_t cid = Tesuite_Case("CGI: test simple");
    Cgi_Append(cgi,"SIMPLE",-1);
    Cgi_Write_Out(cgi,CGI_OUT_TEXTHTML);
    Tesuite_Case_Successed_Id(cid);
  }

void test_cgi(YO_CGI *cgi)
  {
    __Auto_Release
      {
................................................................................
        char *test;
        cgi = Cgi_Query_Params(cgi,0,0);
        
        test = Xnode_Value_Get_Str(cgi->params,"test",0);
        if ( !test )
          {
            Cgi_Append(cgi,"ERROR",-1);
            Cgi_Write_Out(cgi,CGI_OUT_TEXTHTML);
          }
        else if ( !strcmp_I(test,"simple") )
          test_cgi_simple(cgi); 
      }
  }

void hosted_test_cgi(YO_WEBHOST_CGIST *st, int error)
................................................................................
        YO_WEBHOST *webhost = Webhost_Init();
        YO_HTTPD *httpd = Httpd_Server(Webhost_Callback,webhost);

        if ( Prog_Has_Opt("hosted") )
          Webhost_Register_Service(webhost,"/cgi",hosted_test_cgi,0);        
        
        Webhost_Set_Exec_Root(webhost,Prog_Directory());
        Httpd_Listen(httpd,"127.0.0.1",9123,0);        
        http_status = Httpx_Get(0,"http://localhost:9123/cgi?test=simple",0,Buffer_As_File(bf),0);
        Httpd_Shutdown(httpd);
        while ( Tasque_Perform_Update(0,0) ) ;
        if ( http_status != 200 || !bf->count || !!strcmp(bf->at,"SIMPLE") )
          __Raise_Format(YO_ERROR_TESUITE_FAIL,("response: %d, %s",http_status,(!bf->at?"<null>":(char*)bf->at)));
      }
    Tesuite_Case_Successed_Id(cid);

Changes to tests/xdfsign.c.

Changes to webhost.hc.

660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
  {
    int i;
    YO_WEBHOST *host = _host;
    char *script = 0, *pathinfo = 0;
    
    if ( status == HTTPD_RQST_CONNECT )
      {
        Log_Debug("[%p] CONNECT %s:%d",rqst,rqst->remote_addr,rqst->remote_port);
        return HTTPD_ACCEPT;
      }
    else if ( status == HTTPD_RQST_POSTDTA )
      return HTTPD_ACCEPT;
    else if ( status == HTTPD_RQST_PERFORM )
      {
        YO_FILE_STATS stats = {0};
        YO_URL *url = Url_Parse_Uri(rqst->uri);
        char *path = 0;
        int rng_pos, rng_len;

        Log_Info("[%p] %s/1.%d %s",rqst,Httpd_Method_String(rqst->method),rqst->httpver,rqst->uri);
        Logout_Debug(Dicto_Format(rqst->qhdr,Buffer_Print,0,1));
        
        if ( rqst->instrm_length && Log_Level(YO_LOG_INFO) )
          {
            enum { MAX_L = 60 };
            int L = Yo_Minu(MAX_L,rqst->instrm_length);
            byte_t *b = __Zero_Malloc(MAX_L+1);
            Oj_Seek(rqst->instrm,0,0);
            Oj_Read(rqst->instrm,b,L,L);
            Oj_Seek(rqst->instrm,0,0);
            for ( i = 0; i < L; ++i ) if ( b[i] < 30 || b[i] > 127 ) b[i] = '.';
            if ( rqst->instrm_length > MAX_L ) memcpy(b+MAX_L-3,">>>",3);
            Log_Info("[%p] POSTDTA %s",rqst,b);
          }
        
        if ( host->services )
          {
            YO_WEBHOST_SERVICE *svc = 0;
            svc = Webhost_Find_Service(host->services,url->query,&script,&pathinfo);
            if ( svc )
              {







|











|
|

|










|







660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
  {
    int i;
    YO_WEBHOST *host = _host;
    char *script = 0, *pathinfo = 0;
    
    if ( status == HTTPD_RQST_CONNECT )
      {
        //Log_Debug("[%p] CONNECT %s:%d",rqst,rqst->remote_addr,rqst->remote_port);
        return HTTPD_ACCEPT;
      }
    else if ( status == HTTPD_RQST_POSTDTA )
      return HTTPD_ACCEPT;
    else if ( status == HTTPD_RQST_PERFORM )
      {
        YO_FILE_STATS stats = {0};
        YO_URL *url = Url_Parse_Uri(rqst->uri);
        char *path = 0;
        int rng_pos, rng_len;

        //Log_Info("[%p] %s/1.%d %s",rqst,Httpd_Method_String(rqst->method),rqst->httpver,rqst->uri);
        //Logout_Debug(Dicto_Format(rqst->qhdr,Buffer_Print,0,1));
        
        /*if ( rqst->instrm_length && Log_Level(YO_LOG_INFO) )
          {
            enum { MAX_L = 60 };
            int L = Yo_Minu(MAX_L,rqst->instrm_length);
            byte_t *b = __Zero_Malloc(MAX_L+1);
            Oj_Seek(rqst->instrm,0,0);
            Oj_Read(rqst->instrm,b,L,L);
            Oj_Seek(rqst->instrm,0,0);
            for ( i = 0; i < L; ++i ) if ( b[i] < 30 || b[i] > 127 ) b[i] = '.';
            if ( rqst->instrm_length > MAX_L ) memcpy(b+MAX_L-3,">>>",3);
            Log_Info("[%p] POSTDTA %s",rqst,b);
          }*/
        
        if ( host->services )
          {
            YO_WEBHOST_SERVICE *svc = 0;
            svc = Webhost_Find_Service(host->services,url->query,&script,&pathinfo);
            if ( svc )
              {

Changes to xdata.hc.

710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
    YO_XNODE *n;
    
    STRICT_REQUIRE( doc );
    STRICT_REQUIRE( tag );
    STRICT_REQUIRE( idx );
    
    newidx = ++doc->last_node;
    ref = Xdata_Idxref_No(doc,newidx,&no);
    if ( !doc->nodes[ref] )
      {
        int count = sizeof(YO_XNODE)*Number_Of_Nodes_In_List(ref);
        doc->nodes[ref] = __Malloc_Npl(count);
        memset(doc->nodes[ref],0xff,count);
      }








|







710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
    YO_XNODE *n;
    
    STRICT_REQUIRE( doc );
    STRICT_REQUIRE( tag );
    STRICT_REQUIRE( idx );
    
    newidx = ++doc->last_node;
    ref = Xdata_Idxref_No(doc,(ushort_t)newidx,&no);
    if ( !doc->nodes[ref] )
      {
        int count = sizeof(YO_XNODE)*Number_Of_Nodes_In_List(ref);
        doc->nodes[ref] = __Malloc_Npl(count);
        memset(doc->nodes[ref],0xff,count);
      }

Changes to xdef.hc.

790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
...
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
                L[i] = n->next|((u32_t)nn->tag << 16);
                n = nn;
              }
            qsort(L,ncount,4,Compare_u32);
            for ( i = 0; i < ncount; )
              {
                char *tag = r->xdata->tags[(L[i]>>16)-1];
                n = Xdata_Idxref(r->xdata,L[i]&0x0ffff);
                Buffer_Fill_Append(bf,' ',indent*YO_XDEF_INDENT_WIDTH);
                Buffer_Fill_Append(bf,'"',1);
                Buffer_Append(bf,tag,-1);
                if ( i + 1 < ncount && !((L[i]^L[i+1])>>16) )
                  {
                    Buffer_Append(bf,"\" : [",5);
                    for(;;) 
................................................................................
                        Buffer_Fill_Append(bf,'}',1);
                        ++i;
                        if ( i < ncount && !((L[i-1]^L[i])>>16) )
                          {
                            Buffer_Fill_Append(bf,',',1);
                            Buffer_Fill_Append(bf,'\n',1);
                            Buffer_Fill_Append(bf,' ',indent*YO_XDEF_INDENT_WIDTH);
                            n = Xdata_Idxref(r->xdata,L[i]&0x0ffff);
                          }
                        else
                          break;
                      }
                    Buffer_Fill_Append(bf,']',1);
                  }
                else







|







 







|







790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
...
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
                L[i] = n->next|((u32_t)nn->tag << 16);
                n = nn;
              }
            qsort(L,ncount,4,Compare_u32);
            for ( i = 0; i < ncount; )
              {
                char *tag = r->xdata->tags[(L[i]>>16)-1];
                n = Xdata_Idxref(r->xdata,(ushort_t)(L[i]&0x0ffff));
                Buffer_Fill_Append(bf,' ',indent*YO_XDEF_INDENT_WIDTH);
                Buffer_Fill_Append(bf,'"',1);
                Buffer_Append(bf,tag,-1);
                if ( i + 1 < ncount && !((L[i]^L[i+1])>>16) )
                  {
                    Buffer_Append(bf,"\" : [",5);
                    for(;;) 
................................................................................
                        Buffer_Fill_Append(bf,'}',1);
                        ++i;
                        if ( i < ncount && !((L[i-1]^L[i])>>16) )
                          {
                            Buffer_Fill_Append(bf,',',1);
                            Buffer_Fill_Append(bf,'\n',1);
                            Buffer_Fill_Append(bf,' ',indent*YO_XDEF_INDENT_WIDTH);
                            n = Xdata_Idxref(r->xdata,(ushort_t)(L[i]&0x0ffff));
                          }
                        else
                          break;
                      }
                    Buffer_Fill_Append(bf,']',1);
                  }
                else

Changes to yoyo.hc.

125
126
127
128
129
130
131
132



133
134
135
136
137
138
139
140
141
142
143
144





145
146
147
148
149
150
151
...
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
...
559
560
561
562
563
564
565
566
567
568












569
570
571
572


573
574
575


576
577
578
579
580
581
582
....
1246
1247
1248
1249
1250
1251
1252




1253
1254
1255
1256
1257
1258
1259
....
2238
2239
2240
2241
2242
2243
2244




2245
2246
2247
2248
2249
2250
2251
# endif
# if !defined _WINDOWS_
#  if !defined _X86_ && defined __i386
#   define _X86_ 1
#  endif
# endif
# if !defined WINVER
#  define WINVER 0x500



# endif
# define WIN32_LEAN_AND_MEAN
# include <windef.h>
# include <winbase.h>
# include <excpt.h>
# include <objbase.h>
# include <io.h>
# include <process.h>
# include <malloc.h> /* alloca */
# if defined _MSC_VER && _MSC_VER >= 1600
#  include <intrin.h>
#  pragma intrinsic(_ReadWriteBarrier)





# endif
# ifdef _PTHREADS 
#   define _XTHREADS
#   ifdef __GNUC__
#     include <pthread.h>
#   else
#     include "otros/winpthreads.hc" /* testing purposes only! */ 
................................................................................
# define YO_MULTITHREADED(Expr)

# define __Xchg_Interlock if (0) {;} else
# define __Xchg_Sync(Lx)  if (0) {;} else
# define Yo_Wait_Xchg_Lock(Ptr)
# define Yo_Xchg_Unlock(Ptr)

# define __Mtx_Sync(Mtx)  if (0) {;} else

#else /* -D _THREADS */

#if defined _MSC_VER && !defined _PTHREADS && !defined _RTTLS
# define __Tls_Define(Name)  __declspec(thread) void *Name = 0
# define __Tls_Declare(Name) extern __declspec(thread) void *Name
# define __Tls_Set(Name,Val) ((Name) = (Val))
# define __Tls_Get(Name)     (Name)
................................................................................
    extern char YO_LOCAL_ID(__assert__)[(expr)?1:-1]
#else
  #define __Static_Assert_S(expr,S) static_assert(expr,S)
#endif

#define __Static_Assert(expr) __Static_Assert_S(expr,#expr)

#define REQUIRE(Expr) \
  if (Expr); else Yo_Fatal(YO_ERROR_REQUIRE_FAILED,__Yo_Expr__(Expr),__Yo_FILE__,__LINE__)
#define PANICA(msg) Yo_Fatal(YO_FATAL_ERROR,msg,__Yo_FILE__,__LINE__)













#ifdef _STRICT
# define STRICT_REQUIRE(Expr) REQUIRE(Expr)
# define STRICT_CHECK(Expr) (Expr)


#else
# define STRICT_REQUIRE(Expr) ((void)0)
# define STRICT_CHECK(Expr) (1)


#endif /* _STRICT */

enum 
  { 
    YO_OBJECT_SIGNATURE_PFX  =  0x00594f59, /*'YOY'*/  
    YO_OBJECT_SIGNATURE_HEAP =  0x4f594f59, /*'YOYO'*/  
    YO_MEMPOOL_PIECE_MAXSIZE = 1*KILOBYTE,
................................................................................
      Yo_Refresh(p,q);
    else if ( !p )
      Yo_Pool(q);
    return q;
  }
#endif
  ;





#if defined _YO_CORE_BUILTIN && defined __windoze && defined __VSCPRINTF
int _vscprintf(char *fmt,va_list va)
  {
    static char simulate[4096*4] = {0};
    return vsprintf(simulate,fmt,va);
  }
................................................................................

#define __Object(Size,Funcs)            Yo_Object(Size,Funcs)
#define __Object_Dtor(Size,Dtor)        Yo_Object_Dtor(Size,Dtor)
#define __Object_Extend(Obj,Name,Func)  Yo_Object_Extend(Obj,Name,Func)
#define __Destruct(Ptr)                 Yo_Object_Destruct(Ptr)
#define __Clone(Size,Ptr)               Yo_Object_Clone(Size,Ptr)





#ifdef _STRONGPOOL

#define __Auto_Release \
  switch ( 0 ) while ( 1 ) \
    if ( 1 ) \
      { \
        Yo_Unwind_Scope(0,0,0); \







|
>
>
>












>
>
>
>
>







 







<
<







 







<
|

>
>
>
>
>
>
>
>
>
>
>
>




>
>



>
>







 







>
>
>
>







 







>
>
>
>







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
...
471
472
473
474
475
476
477


478
479
480
481
482
483
484
...
565
566
567
568
569
570
571

572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
....
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
....
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
# endif
# if !defined _WINDOWS_
#  if !defined _X86_ && defined __i386
#   define _X86_ 1
#  endif
# endif
# if !defined WINVER
#  define WINVER 0x600
# endif
# if !defined _WIN32_WINNT
#  define _WIN32_WINNT 0x600
# endif
# define WIN32_LEAN_AND_MEAN
# include <windef.h>
# include <winbase.h>
# include <excpt.h>
# include <objbase.h>
# include <io.h>
# include <process.h>
# include <malloc.h> /* alloca */
# if defined _MSC_VER && _MSC_VER >= 1600
#  include <intrin.h>
#  pragma intrinsic(_ReadWriteBarrier)
# elif defined _MSC_VER && _MSC_VER >= 1300
   extern void _ReadWriteBarrier();
#  pragma intrinsic(_ReadWriteBarrier)
# else
#  define _ReadWriteBarrier() ((void)0)
# endif
# ifdef _PTHREADS 
#   define _XTHREADS
#   ifdef __GNUC__
#     include <pthread.h>
#   else
#     include "otros/winpthreads.hc" /* testing purposes only! */ 
................................................................................
# define YO_MULTITHREADED(Expr)

# define __Xchg_Interlock if (0) {;} else
# define __Xchg_Sync(Lx)  if (0) {;} else
# define Yo_Wait_Xchg_Lock(Ptr)
# define Yo_Xchg_Unlock(Ptr)



#else /* -D _THREADS */

#if defined _MSC_VER && !defined _PTHREADS && !defined _RTTLS
# define __Tls_Define(Name)  __declspec(thread) void *Name = 0
# define __Tls_Declare(Name) extern __declspec(thread) void *Name
# define __Tls_Set(Name,Val) ((Name) = (Val))
# define __Tls_Get(Name)     (Name)
................................................................................
    extern char YO_LOCAL_ID(__assert__)[(expr)?1:-1]
#else
  #define __Static_Assert_S(expr,S) static_assert(expr,S)
#endif

#define __Static_Assert(expr) __Static_Assert_S(expr,#expr)


#define __REQUIRE_FATAL(Expr) Yo_Fatal(YO_ERROR_REQUIRE_FAILED,__Yo_Expr__(Expr),__Yo_FILE__,__LINE__)
#define PANICA(msg) Yo_Fatal(YO_FATAL_ERROR,msg,__Yo_FILE__,__LINE__)
#define UNREACHABLE PANICA("unreachable code")

#if defined __GNUC__ && ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__>=5) )
#define ASSUME(Expr)  if (Expr); else __builtin_unreachable();
#define REQUIRE(Expr) if (Expr); else { __REQUIRE_FATAL(Expr); __builtin_unreachable(); }
#elif defined _MSC_VER
#define ASSUME(expr)  __assume(expr)
#define REQUIRE(Expr) if (Expr); else { __REQUIRE_FATAL(Expr); __assume(0); }
#else 
#define ASSUME(expr)  ((void)0)
#define REQUIRE(Expr) if (Expr); else __REQUIRE_FATAL(Expr)
#endif

#ifdef _STRICT
# define STRICT_REQUIRE(Expr) REQUIRE(Expr)
# define STRICT_CHECK(Expr) (Expr)
# define STRICT_UNREACHABLE UNREACHABLE
# define STRICT_ASSUME(Expr) REQUIRE(Expr)
#else
# define STRICT_REQUIRE(Expr) ((void)0)
# define STRICT_CHECK(Expr) (1)
# define STRICT_UNREACHABLE ASSUME(0);
# define STRICT_ASSUME(Expr) ASSUME(Expr)
#endif /* _STRICT */

enum 
  { 
    YO_OBJECT_SIGNATURE_PFX  =  0x00594f59, /*'YOY'*/  
    YO_OBJECT_SIGNATURE_HEAP =  0x4f594f59, /*'YOYO'*/  
    YO_MEMPOOL_PIECE_MAXSIZE = 1*KILOBYTE,
................................................................................
      Yo_Refresh(p,q);
    else if ( !p )
      Yo_Pool(q);
    return q;
  }
#endif
  ;

#if defined _MSC_VER && _MSC_VER < 1300
#  define __VSCPRINTF
#endif

#if defined _YO_CORE_BUILTIN && defined __windoze && defined __VSCPRINTF
int _vscprintf(char *fmt,va_list va)
  {
    static char simulate[4096*4] = {0};
    return vsprintf(simulate,fmt,va);
  }
................................................................................

#define __Object(Size,Funcs)            Yo_Object(Size,Funcs)
#define __Object_Dtor(Size,Dtor)        Yo_Object_Dtor(Size,Dtor)
#define __Object_Extend(Obj,Name,Func)  Yo_Object_Extend(Obj,Name,Func)
#define __Destruct(Ptr)                 Yo_Object_Destruct(Ptr)
#define __Clone(Size,Ptr)               Yo_Object_Clone(Size,Ptr)

#define __Free(P)                       free(P)
#define __Ref_Set(PP,R)                 if (0); else { __Unrefe(PP); PP = __Refe(R); }   
#define __Ptr_Set(PP,R)                 if (0); else { free(PP); PP = R; }   

#ifdef _STRONGPOOL

#define __Auto_Release \
  switch ( 0 ) while ( 1 ) \
    if ( 1 ) \
      { \
        Yo_Unwind_Scope(0,0,0); \

Changes to zlib.hc.