Menu

#174 Bug: realtime.c - StoreLogEntry - inbound url may have no scheme at all

v1.0_(example)
open
realtime (1)
5
2020-12-19
2020-12-08
Viacheslav
No

Hello,

Looks like StoreLogEntry function is trying to parse log entry url even if there is no scheme provided at all, for example for CONNECT requests, which is in turn leading to 8 characters truncated urls in html output. Please see attached screen-shot.

1 Attachments

Discussion

  • Viacheslav

    Viacheslav - 2020-12-08

    few more screen-shots

     
  • Viacheslav

    Viacheslav - 2020-12-19

    quickfix

    static void StoreLogEntry(struct RealtimeReadLogStruct *Dest,struct ReadLogStruct *Entry)
    {
            memcpy(&Dest->EntryTime,&Entry->EntryTime,sizeof(Dest->EntryTime));
            safe_strcpy(Dest->Ip,Entry->Ip,sizeof(Dest->Ip));
            if (Entry->Url)
            {
                    int i = 0;
                    const char *url=Entry->Url;
                    const char *proto=strstr(url,"://");
                    if (proto) {
                      url = proto+3;
                    }
                    i = strlen(url) < sizeof(Dest->Url) ? strlen(url) : sizeof(Dest->Url)-1;
                    memcpy(Dest->Url,url,i);
                    Dest->Url[i]='\0';
            }
            safe_strcpy(Dest->User,Entry->User,sizeof(Dest->User));
            safe_strcpy(Dest->HttpMethod,Entry->HttpMethod,sizeof(Dest->HttpMethod));
    }
    
     

Log in to post a comment.