Exemple #1
0
// écrire backblue.gif
int verif_backblue(httrackp* opt, const char* base) {
  int* done = &opt->state.verif_backblue_done;
  int ret=0;
  //
  if (!base) {   // init
    *done=0;
    return 0;
  }
  if ( (!*done)
    || (fsize(fconcat(OPT_GET_BUFF(opt), base,"backblue.gif")) != HTS_DATA_BACK_GIF_LEN)) {
    FILE* fp = filecreate(&opt->state.strc, fconcat(OPT_GET_BUFF(opt), base,"backblue.gif"));
    *done=1;
    if (fp) {
      if (fwrite(HTS_DATA_BACK_GIF,HTS_DATA_BACK_GIF_LEN,1,fp) != HTS_DATA_BACK_GIF_LEN)
        ret=1;
      fclose(fp);
      usercommand(opt,0,NULL,fconcat(OPT_GET_BUFF(opt), base,"backblue.gif"),"","");
    } else
      ret=1;
    //
    fp = filecreate(&opt->state.strc, fconcat(OPT_GET_BUFF(opt), base,"fade.gif"));
    if (fp) {
      if (fwrite(HTS_DATA_FADE_GIF,HTS_DATA_FADE_GIF_LEN,1,fp) != HTS_DATA_FADE_GIF_LEN)
        ret=1;
      fclose(fp);
      usercommand(opt,0,NULL,fconcat(OPT_GET_BUFF(opt), base,"fade.gif"),"","");
    } else
      ret=1;
  } 
  return ret;
}
Exemple #2
0
int hts_extract_meta(const char* path) {
    char catbuff[CATBUFF_SIZE];
    unzFile zFile = unzOpen(fconcat(catbuff,path,"hts-cache/new.zip"));
    zipFile zFileOut = zipOpen(fconcat(catbuff,path,"hts-cache/meta.zip"), 0);
    if (zFile != NULL && zFileOut != NULL) {
        if (unzGoToFirstFile(zFile) == Z_OK) {
            zip_fileinfo fi;
            unz_file_info ufi;
            char BIGSTK filename[HTS_URLMAXSIZE * 4];
            char BIGSTK comment[8192];
            memset(comment, 0, sizeof(comment));       // for truncated reads
            memset(&fi, 0, sizeof(fi));
            memset(&ufi, 0, sizeof(ufi));
            do  {
                int readSizeHeader;
                filename[0] = '\0';
                comment[0] = '\0';

                if (unzOpenCurrentFile(zFile) == Z_OK) {
                    if (
                        (readSizeHeader = unzGetLocalExtrafield(zFile, comment, sizeof(comment) - 2)) > 0
                        &&
                        unzGetCurrentFileInfo(zFile, &ufi, filename, sizeof(filename) - 2, NULL, 0, NULL, 0) == Z_OK
                    )
                    {
                        comment[readSizeHeader] = '\0';
                        fi.dosDate = ufi.dosDate;
                        fi.internal_fa = ufi.internal_fa;
                        fi.external_fa = ufi.external_fa;
                        if (zipOpenNewFileInZip(zFileOut,
                                                filename,
                                                &fi,
                                                NULL,
                                                0,
                                                NULL,
                                                0,
                                                NULL, /* comment */
                                                Z_DEFLATED,
                                                Z_DEFAULT_COMPRESSION) == Z_OK)
                        {
                            if (zipWriteInFileInZip(zFileOut, comment, (int) strlen(comment)) != Z_OK) {
                            }
                            if (zipCloseFileInZip(zFileOut) != Z_OK) {
                            }
                        }
                    }
                    unzCloseCurrentFile(zFile);
                }
            } while( unzGoToNextFile(zFile) == Z_OK );
        }
        zipClose(zFileOut, "Meta-data extracted by HTTrack/"HTTRACK_VERSION);
        unzClose(zFile);
        return 1;
    }
    return 0;
}
Exemple #3
0
Fichier : htshelp.c Projet : ahua/c
// Créer un index.html vide
void make_empty_index(char* str) {
#if 0
  if (!fexist(fconcat(str,"index.html"))) {
    FILE* fp=fopen(fconcat(str,"index.html"),"wb");
    if (fp) {
      fprintf(fp,"<!-- "HTS_TOPINDEX" -->"CRLF);
      fprintf(fp,"<HTML><BODY>Index is empty!<BR>(File used to index all HTTrack projects)</BODY></HTML>"CRLF);
      fclose(fp);
    }
  }
#endif
}
Exemple #4
0
void CNewProj::Changeprojname(CString stl) {
	char catbuff[CATBUFF_SIZE];
	CWaitCursor wait;
  CString st;
  //
  if (stl.GetLength()==0 || stl.GetLength() > HTS_URLMAXSIZE) {
    //m_ctl_idok.ModifyStyle(0,WS_DISABLED);
    SetDlgItemTextCP(this, IDC_STATIC_comments,LANG(LANG_S30));
    SetDlgItemTextCP(this, IDC_STATIC_projname,LANG(LANG_S11c));
    this_CWizTab->SetWizardButtons(PSWIZB_BACK);
    can_click_next=FALSE;
  } else {
    char tempo[HTS_URLMAXSIZE*2];
    GetDlgItemText(IDC_projpath,st);
    if (st.GetLength() + stl.GetLength() + 32 > sizeof(tempo)) {
      can_click_next=FALSE;
    } else {
      strcpybuff(tempo,st);
      strcatbuff(tempo,"/");
      strcatbuff(tempo,stl);
      strcatbuff(tempo,"/");
      if (fexist(fconcat(catbuff,tempo,"hts-cache/winprofile.ini"))     // un cache est présent
        && fsize(fconcat(catbuff,tempo,"hts-cache/winprofile.ini"))>0) {   // taille log contrôle>0
        CString strSection       = "OptionsValues";
        CString st  = MyGetProfileString(fconcat(catbuff,tempo,"hts-cache/winprofile.ini"),strSection,"CurrentUrl");
        CString st2 = MyGetProfileString(fconcat(catbuff,tempo,"hts-cache/winprofile.ini"),strSection,"Category");
        //
        SetDlgItemTextCP(this, IDC_STATIC_comments, st);
        SetDlgItemTextCP(this, IDC_projcateg, st2);
        // Static
        SetDlgItemTextCP(this, IDC_STATIC_projname,LANG(LANG_S11b));
      } else {
        SetDlgItemTextCP(this, IDC_STATIC_comments,LANG(LANG_S31));
        SetDlgItemTextCP(this, IDC_STATIC_projname,LANG(LANG_S11));
      }
      //m_ctl_idok.ModifyStyle(WS_DISABLED,0);
      //if (!can_click_next)
      this_CWizTab->SetWizardButtons(PSWIZB_BACK|PSWIZB_NEXT);
      can_click_next=TRUE;
    }
  }
  //m_ctl_idok.RedrawWindow();
}
void Cinprogress::Oniplog(int mode)  {
	char catbuff[CATBUFF_SIZE];
  if (!BackAffLog) {  // pas encore lancé
    strcpybuff(pathlog,dialog0->GetPath());
    if (strlen(pathlog)>0)
    if ((pathlog[strlen(pathlog)-1]!='/') && (pathlog[strlen(pathlog)-1]!='\\'))
      strcatbuff(pathlog,"/");
    // fichier log existe ou on est télécommandé par un !
    if ( (fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-err.txt")))
      || (fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-log.txt")))
      || (ShellOptions != NULL && ShellOptions->choixdeb[0]=='!') ) {
      if (mode)
        form.type_log=0;
      else
        form.type_log=1;
      strcpybuff(form.pathlog,pathlog);
      BackAffLog = AfxBeginThread(AffLog,this);
    } else {
      char s[1024];
      sprintf(s,LANG(LANG_H2 /*"No log files in %s!","Aucun fichier d'audit dans %s!"*/),pathlog);
      AfxMessageBox(s,MB_OK+MB_ICONEXCLAMATION);
    }
  }
}
Exemple #6
0
HTSEXT_API int hts_buildtopindex(httrackp* opt,const char* path,const char* binpath) {
  FILE* fpo;
  int retval=0;
  char BIGSTK rpath[1024*2];
  char *toptemplate_header=NULL,*toptemplate_body=NULL,*toptemplate_footer=NULL,*toptemplate_bodycat=NULL;
 	char catbuff[CATBUFF_SIZE];

  // et templates html
  toptemplate_header=readfile_or(fconcat(catbuff, binpath,"templates/topindex-header.html"),HTS_INDEX_HEADER);
  toptemplate_body=readfile_or(fconcat(catbuff, binpath,"templates/topindex-body.html"),HTS_INDEX_BODY);
  toptemplate_bodycat=readfile_or(fconcat(catbuff, binpath,"templates/topindex-bodycat.html"),HTS_INDEX_BODYCAT);
  toptemplate_footer=readfile_or(fconcat(catbuff, binpath,"templates/topindex-footer.html"),HTS_INDEX_FOOTER);
  
  if (toptemplate_header && toptemplate_body && toptemplate_footer && toptemplate_bodycat) {
    
    strcpybuff(rpath,path);
    if (rpath[0]) {
      if (rpath[strlen(rpath)-1]=='/')
        rpath[strlen(rpath)-1]='\0';
    }
    
    fpo=fopen(fconcat(catbuff, rpath,"/index.html"),"wb");
    if (fpo) {
      find_handle h;
      verif_backblue(opt,concat(catbuff, rpath,"/"));    // générer gif
      // Header
      fprintf(fpo,toptemplate_header,
        "<!-- Mirror and index made by HTTrack Website Copier/"HTTRACK_VERSION" "HTTRACK_AFF_AUTHORS" -->"
        );
      
      /* Find valid project names */
      h = hts_findfirst(rpath);
      if (h) {
        struct topindex_chain * chain=NULL;
        struct topindex_chain * startchain=NULL;
        String iname = STRING_EMPTY;
        int chainSize = 0;
        do {
          if (hts_findisdir(h)) {
            StringCopy(iname,rpath);
            StringCat(iname,"/");
            StringCat(iname,hts_findgetname(h));
            StringCat(iname,"/index.html");
            if (fexist(StringBuff(iname))) {
              int level = 0;
              char* category = NULL;
              struct topindex_chain * oldchain=chain;
              
              /* Check for an existing category */
              StringCopy(iname,rpath);
              StringCat(iname,"/");
              StringCat(iname,hts_findgetname(h));
              StringCat(iname,"/hts-cache/winprofile.ini");
              if (fexist(StringBuff(iname))) {
                category = hts_getcategory(StringBuff(iname));
                if (category != NULL) {
                  if (*category == '\0') {
                    freet(category);
                    category = NULL;
                  }
                }
              }
              if (category == NULL) {
                category = strdupt("No categories");
                level = 1;
              }

              chain=calloc(sizeof(struct topindex_chain), 1);
              chainSize++;
              if (!startchain) {
                startchain=chain;
              }
              if (chain) {
                if (oldchain) {
                  oldchain->next=chain;
                }
                chain->next=NULL;
                strcpybuff(chain->name, hts_findgetname(h));
                chain->category = category;
                chain->level = level;
              }
            }
            
          }
        } while(hts_findnext(h));
        hts_findclose(h);
        StringFree(iname);
        
        /* Sort chain */
        {
          struct topindex_chain** sortedElts = (struct topindex_chain**) calloct(sizeof(topindex_chain*), chainSize);
          assertf(sortedElts != NULL);
          if (sortedElts != NULL) {
            int i;
            char* category = "";
            
            /* Build array */
            struct topindex_chain * chain = startchain;
            for(i = 0 ; i < chainSize ; i++) {
              assertf(chain != NULL);
              sortedElts[i] = chain;
              chain = chain->next;
            }
            qsort(sortedElts, chainSize, sizeof(topindex_chain*), sortTopIndexFnc);
            
            /* Build sorted index */
            for(i = 0 ; i < chainSize ; i++) {
              char BIGSTK hname[HTS_URLMAXSIZE*2];
              strcpybuff(hname,sortedElts[i]->name);
              escape_check_url(hname);

              /* Changed category */
              if (strcmp(category, sortedElts[i]->category) != 0) {
                category = sortedElts[i]->category;
                fprintf(fpo,toptemplate_bodycat, category);
              }
              fprintf(fpo,toptemplate_body,
                hname,
                sortedElts[i]->name
                );
            }
            
            /* Wipe elements */
            for(i = 0 ; i < chainSize ; i++) {
              freet(sortedElts[i]->category);
              freet(sortedElts[i]);
              sortedElts[i] = NULL;
            }
            freet(sortedElts);
            
            /* Return value */
            retval=1;
          }
        }
        
      }
      
      // Footer
      fprintf(fpo,toptemplate_footer,
        "<!-- Mirror and index made by HTTrack Website Copier/"HTTRACK_VERSION" "HTTRACK_AFF_AUTHORS" -->"
        );
      
      fclose(fpo);
      
    }
    
  }

  if (toptemplate_header)
    freet(toptemplate_header);
  if (toptemplate_body)
    freet(toptemplate_body);
  if (toptemplate_footer)
    freet(toptemplate_footer);
  if (toptemplate_body)
    freet(toptemplate_body);
  
  return retval;
}
Exemple #7
0
// lire cookies.txt
// lire également (Windows seulement) les *@*.txt (cookies IE copiés)
// !=0 : erreur
int cookie_load(t_cookie * cookie, const char *fpath, const char *name) {
  char catbuff[CATBUFF_SIZE];
  char buffer[8192];

  //  cookie->data[0]='\0';

  // Fusionner d'abord les éventuels cookies IE
#ifdef _WIN32
  {
    WIN32_FIND_DATAA find;
    HANDLE h;
    char pth[MAX_PATH + 32];

    strcpybuff(pth, fpath);
    strcatbuff(pth, "*@*.txt");
    h = FindFirstFileA((char *) pth, &find);
    if (h != INVALID_HANDLE_VALUE) {
      do {
        if (!(find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
          if (!(find.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)) {
            FILE *fp = fopen(fconcat(catbuff, fpath, find.cFileName), "rb");

            if (fp) {
              char cook_name[256];
              char cook_value[1000];
              char domainpathpath[512];
              char dummy[512];

              //
              char domain[256]; // domaine cookie (.netscape.com)
              char path[256];   // chemin (/)
              int cookie_merged = 0;

              //
              // Read all cookies
              while(!feof(fp)) {
                cook_name[0] = cook_value[0] = domainpathpath[0]
                  = dummy[0] = domain[0] = path[0] = '\0';
                linput(fp, cook_name, 250);
                if (!feof(fp)) {
                  linput(fp, cook_value, 250);
                  if (!feof(fp)) {
                    int i;

                    linput(fp, domainpathpath, 500);
                    /* Read 6 other useless values */
                    for(i = 0; !feof(fp) && i < 6; i++) {
                      linput(fp, dummy, 500);
                    }
                    if (strnotempty(cook_name)
                        && strnotempty(cook_value)
                        && strnotempty(domainpathpath)) {
                      if (ident_url_absolute(domainpathpath, domain, path) >= 0) {
                        cookie_add(cookie, cook_name, cook_value, domain, path);
                        cookie_merged = 1;
                      }
                    }
                  }
                }
              }
              fclose(fp);
              if (cookie_merged)
                remove(fconcat(catbuff, fpath, find.cFileName));
            }                   // if fp
          }
      } while(FindNextFileA(h, &find));
      FindClose(h);
    }
  }
#endif

  // Ensuite, cookies.txt
  {
    FILE *fp = fopen(fconcat(catbuff, fpath, name), "rb");

    if (fp) {
      char BIGSTK line[8192];

      while((!feof(fp)) && (((int) strlen(cookie->data)) < cookie->max_len)) {
        rawlinput(fp, line, 8100);
        if (strnotempty(line)) {
          if (strlen(line) < 8000) {
            if (line[0] != '#') {
              char domain[256]; // domaine cookie (.netscape.com)
              char path[256];   // chemin (/)
              char cook_name[1024];     // nom cookie (MYCOOK)
              char BIGSTK cook_value[8192];     // valeur (ID=toto,S=1234)

              strcpybuff(domain, cookie_get(buffer, line, 0));  // host
              strcpybuff(path, cookie_get(buffer, line, 2));    // path
              strcpybuff(cook_name, cookie_get(buffer, line, 5));       // name
              strcpybuff(cook_value, cookie_get(buffer, line, 6));      // value
#if DEBUG_COOK
              printf("%s\n", line);
#endif
              cookie_add(cookie, cook_name, cook_value, domain, path);
            }
          }
        }
      }
      fclose(fp);
      return 0;
    }
  }
  return -1;
}
LRESULT Cinprogress::OnEndMirror(WPARAM /* wP*/, LPARAM /*lP*/) {
	char catbuff[CATBUFF_SIZE];
	char catbuff2[CATBUFF_SIZE];
  //this_CSplitterFrame->SetNewView(0,1,RUNTIME_CLASS(Cinfoend));

  // Copie de trans.cpp
  this_CWizTab->ModifyStyle(WS_VISIBLE,0,0);
  this_CWizTab->RedrawWindow();
  //
  //{
  //  CWizTab* tmp;
  //  tmp=this_CWizTab;
  this_CWizTab=this_intCWizTab;
  //  this_CWizTab2=tmp;
  //}
  //
  this_CWizTab->ModifyStyle(0,WS_VISIBLE,0);
  this_CWizTab->ModifyStyle(WS_DISABLED,0,0);
  this_CSplitterFrame->RedrawWindow();
  // Fin de Copie de trans.cpp

  this_CWizTab->EndInProgress();
  if (IsWindow(this_Cinfoend->m_hWnd))
    SetDlgItemTextCP(this_Cinfoend, IDC_infoend,end_mirror_msg);

  if (hts_is_exiting(global_opt) == 1) {     /* Interrupted mirror! */
    char pathlog[HTS_URLMAXSIZE*2];
    strcpybuff(pathlog,dialog0->GetPath());
    if (strlen(pathlog)>0) {
      if ((pathlog[strlen(pathlog)-1]!='/') && (pathlog[strlen(pathlog)-1]!='\\'))
        strcatbuff(pathlog,"/");
    }
    // Aborted updated.. restore old cache?!
    if ( 
      fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.zip"))
      ||
      (fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.dat")))
      && (fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.ndx"))) 
      ) {
      if (AfxMessageBox(LANG_F22b,MB_YESNO|MB_DEFBUTTON2) == IDYES) {
        if (fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.dat"))
          && fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.ndx"))) {
          if (remove(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/new.dat"))) {
            AfxMessageBox(LANG_F24 );
          }
          if (remove(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/new.ndx"))) {
            AfxMessageBox(LANG_F24 );
          }
        }
        if (remove(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/new.lst"))) {
          AfxMessageBox(LANG_F24 );
        }
        if (fexist(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.zip"))) {
          if (remove(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/new.zip"))) {
            AfxMessageBox(LANG_F24 );
          }
        }
        remove(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/new.txt"));
        rename(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.zip"),fconcat(catbuff2,sizeof(catbuff2),pathlog,"hts-cache/new.zip"));
        rename(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.dat"),fconcat(catbuff2,sizeof(catbuff2),pathlog,"hts-cache/new.dat"));
        rename(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.ndx"),fconcat(catbuff2,sizeof(catbuff2),pathlog,"hts-cache/new.ndx"));
        rename(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.lst"),fconcat(catbuff2,sizeof(catbuff2),pathlog,"hts-cache/new.lst"));
        rename(fconcat(catbuff,sizeof(catbuff),pathlog,"hts-cache/old.txt"),fconcat(catbuff2,sizeof(catbuff2),pathlog,"hts-cache/new.txt"));
      }
    }
  } else if (hts_is_exiting(global_opt) == 2) {     /* No connection! */
    AfxMessageBox(LANG_F22c );
  }
  return S_OK;
}
Exemple #9
0
/* Code mainly written by Nicolas BENOIT */
static int run_launch_mms(MMSDownloadStruct* pStruct) {
	lien_back* back = pStruct->pBack;
	httrackp* opt = pStruct->pOpt;
	/* */
	char url[HTS_URLMAXSIZE*2];
	char catbuff[CATBUFF_SIZE];
	char catbuff2[CATBUFF_SIZE];
  MMS *mms;
  FILE *f;
  ssize_t len_written;
	uint64_t total_len_written;
	int delay = opt->mms_maxtime;
	time_t end = time(NULL) + delay;
	short checkPending = 0;
	ssize_t existingSize = fsize(back->url_sav);

	// effacer
	strcpybuff(back->r.msg,"");
	back->status=STATUS_FTP_TRANSFER;
	back->r.statuscode=HTTP_OK;
	back->r.size=0;

	/* Create file */
	if (existingSize > 0) {
		/* back->r.out = fileappend(back->url_sav);
		*/
		(void) unlink(fconcat(catbuff,back->url_sav, ".old"));
		if (rename(fconcat(catbuff,back->url_sav, ""), fconcat(catbuff2,back->url_sav, ".old")) == 0) {
			checkPending = 1;
		}
		back->r.out = filecreate(&pStruct->pOpt->state.strc, back->url_sav);
	} else {
		back->r.out = filecreate(&pStruct->pOpt->state.strc, back->url_sav);
	}
	if ((f = back->r.out) != NULL) {
		// create mms resource
		strcpybuff(url, back->url_adr);				/* mms:// */
		strcatbuff(url, back->url_fil);
		if ( ( mms = mms_create( url, f, NULL, 0, 1 ) ) != NULL ) {
			if ( mms_connect ( mms ) == 0 ) {
				if ( mms_handshake ( mms ) == 0 ) {
					if ( ( len_written = mms_write_stream_header ( mms ) ) != -1 ) {
						total_len_written = len_written;
						HTS_STAT.HTS_TOTAL_RECV += len_written;

						/* not modified */
						if (checkPending) {
							if (mms->is_live != MMS_LIVE
								&& mms->expected_file_size == existingSize + 50	/* Why 50 additional bytes declared ?? */
								)				// abort download
							{
								fclose(back->r.out);
								f = back->r.out = NULL;
								if (unlink(fconcat(catbuff, back->url_sav, "")) == 0 
									&& rename(fconcat(catbuff, back->url_sav, ".old"), fconcat(catbuff2, back->url_sav, "")) == 0) 
								{
									back->r.notmodified = 1;
									back->r.statuscode = HTTP_OK;
									strcpybuff(back->r.msg, "Not modified");
								} else {
									back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
									strcpybuff(back->r.msg, "Unable to rename previous file (not updated)");
								}
							} else {
								(void) unlink(fconcat(catbuff, back->url_sav, ".old"));
							}
						}

						/* begin rip */
						if ( f != NULL && mms_begin_rip ( mms ) == 0 ) {
							if ( mms->is_live != MMS_LIVE ) {
								back->r.totalsize = mms->expected_file_size;
								back->r.totalsize -= 50;	/* Why 50 additional bytes declared ?? */
							} else
								back->r.totalsize = -1;

							/* Start download */
							while ( !stop_mms(back) ) {
								len_written = mms_write_stream_data ( mms );
								if ( len_written == 0 ) {
									break;
								} else if ( len_written == -1 ) {
									back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
									strcpybuff(back->r.msg, "Unable to write stream data");
									break;
								}

								total_len_written += len_written;
								back->r.size = total_len_written;
								HTS_STAT.HTS_TOTAL_RECV += len_written;

								fflush ( f );

								if ( delay != 0 && end <= time(NULL) ) {
									delay = -1;
									back->r.statuscode = HTTP_OK;
									strcpybuff(back->r.msg, "Download interrupted");
									break;
								}
							}		// while

							back->r.statuscode = HTTP_OK;			/* Finished */
						} else if (f != NULL) {
							back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
							strcpybuff(back->r.msg, "Can not begin ripping");
						}
					} else {
						back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
						strcpybuff(back->r.msg, "Can not write stream header");
					}
				} else {
					back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
					strcpybuff(back->r.msg, "Can not handshake");
				}
				mms_disconnect ( mms );
			} else {
				back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
				strcpybuff(back->r.msg, "Can not connect");
			}
			mms_destroy ( mms );
		} else {
			back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
			strcpybuff(back->r.msg, "Can not create mms resource");
		}
	} else {
		back->r.statuscode = HTTP_INTERNAL_SERVER_ERROR;
		strcpybuff(back->r.msg, "Unable to open local output file");
	}
	return 0;
}