source: titan/plugins/tithek/beeg.h @ 24237

Last change on this file since 24237 was 24237, checked in by nit, 10 years ago

optimize

File size: 863 bytes
RevLine 
[19722]1#ifndef BEEG_H
2#define BEEG_H
3
4char* beeg(char* link)
5{
6        debug(99, "link %s", link);
[24235]7        int debuglevel = getconfigint("debuglevel", NULL);
[19722]8        char* ip = NULL, *pos = NULL, *path = NULL, *streamurl = NULL, *tmpstr = NULL;
[19878]9       
[19722]10        ip = string_replace("http://", "", (char*)link, 0);
11
12        if(ip != NULL)
13                pos = strchr(ip, '/');
14        if(pos != NULL)
15        {
16                pos[0] = '\0';
17                path = pos + 1;
18        }
19
[19884]20        tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
[24235]21        titheklog(debuglevel, "/tmp/beeg1_tmpstr", NULL, tmpstr);
[19722]22
23        if(tmpstr != NULL)
24        {
25                streamurl = string_resub("'file': '","',",tmpstr,0);
26        }
27
28        free(tmpstr); tmpstr = NULL;
29        free(ip), ip = NULL;
30
[24237]31        titheklog(debuglevel, "/tmp/beeg2_streamurl", NULL, streamurl);
[19879]32
[19722]33// segfault munmap_chunk(): invalid pointer
34//      free(pos), pos = NULL;
35//      free(path), path = NULL;
36
37        debug(99, "streamurl: %s", streamurl); 
38        return streamurl;
39}
40
41#endif
Note: See TracBrowser for help on using the repository browser.