Конференция "Сети" » в Win 8 (64) не отправляет запрос
 
  • ProDaNTe © (15.02.13 16:04) [0]
    Делаю прогу, по добавлению новостей на сайт, на XP,Win7 всё 32 бита - отправка запроса работает,в Win 8 (64) не отправляет!!!
    Вот этот запрос???
    procedure TUploadImage.Execute;
    var
    host,site,header,stran,ht,attach,attach2,par1,par2,par3:String;
    post:AnsiString;
    stop:Boolean;
    t:integer;
    fpr:String;
    stream:TFilestream;
    tex,boun,boundary:AnsiString;
    HEX_DIGITS,nor:String;
    Numread:DWORD;
    buf:array [0..1023] of byte;
    bf:byte;
    cli:integer;
    buffile:byte;      
    ms:TStringStream;
    att:TStringStream;
    num:DWORD;
     I: Integer;
     ext,sil:String;
     bn: Integer;
     h: integer;
       hhRequest:HINTERNET;
    begin
     inherited;
    Randomize;       //62
    cli:=0;
    //ftgh

       boundary:='';
    HEX_DIGITS:='0123456789AaBbCcDdEeFfGgHgIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz';
      sil:=Form4.sEdit2.Text;
    fpr:=Copy(sil,LastDelimiter('/',sil)+1,Length(sil)-LastDelimiter('/',sil));
        ms:=TStringStream.Create;
         ext:=ExtractFileExt(sil);
          ms.LoadFromFile(extractfilepath(Application.ExeName)+'Page_Tor'+ext);
            host:=Form3.sEdit1.Text;
            site:=Form3.sEdit10.Text;
            stran:=Form3.sEdit38.Text;
         Header:='Referer: http://'+host+'/'+site+#13+
    'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'  +#13+
    'Accept-Language: ru,ru-RU;q=0.9,en;q=0.8 '+#13+
    'Accept-Encoding:gzip, deflate  '+#13+
    'Connection: Keep-Alive ';
         hhURL := InternetOpenUrl(hhInet,
       PChar('http://'+host+stran),
       pchar(Header),
       StrLen(pchar(Header)),
       0,                            // INTERNET_FLAG_EXISTING_CONNECT
       0);
       stop:=false;

       repeat
       nor:=HEX_DIGITS[Random(61)];
       if (nor<>'') and (Ord(nor)<>0) then begin
       for h := 1 to 61 do
      begin
      if nor=HEX_DIGITS[h] then begin
       boun:=boun+nor;
      end;
      end;
       end;
       nor:='';
      if length(boun)>=22 then stop:=true;
       until stop=true;


       boundary:='----------'+boun;
             Header:='Referer: http://'+host+stran+#13+
    'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'  +#13+
    'Accept-Language: ru,ru-RU;q=0.9,en;q=0.8 '+#13+
    //'Accept-Encoding:gzip, deflate  '+#13+
    'Connection: Keep-Alive '+#13+
    'Content-Type: multipart/form-data; boundary='+ boundary;
         ht:='HTTP/1.1';
      post:='--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"subaction\"'+#13+#10+#13+#10+'upload'+#13+#10+
     '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"area\"'+#13+#10+#13+#10+'short_story'+#13+#10+
     '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"action\"'+#13+#10+#13+#10+'quick'+#13+#10+
     '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"images_number\"'+#13+#10+#13+#10+'1'+#13+#10+
     '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"file_1\"; filename=\"'+fpr+'\"'+#13+#10+
     'Content-Type: image/jpeg'+#13+#10+#13+#10+  ms.DataString+#13+#10+        //Form4.memor.Text
    '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"imageurl\"' +#13+#10+#13+#10+#13+#10;

       if Form5.sComboBox4.ItemIndex=0 then begin
         post:=post+  '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"t_size\"'+#13+#10+#13+#10+Form5.sedit1.text+#13+#10+
       '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"t_seite\"'+#13+#10+#13+#10+'0'+#13+#10;
       end;
           if Form5.sComboBox4.ItemIndex=1 then begin
         post:=post+  '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"t_size\"'+#13+#10+#13+#10+Form5.sedit1.text+#13+#10+
       '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"t_seite\"'+#13+#10+#13+#10+'1'+#13+#10;
       end;
           if Form5.sComboBox4.ItemIndex=2 then begin
         post:=post+  '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"t_size\"'+#13+#10+#13+#10+Form5.sedit1.text+#13+#10+
       '--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"t_seite\"'+#13+#10+#13+#10+'2'+#13+#10;

       end;

       if Form5.sCheckBox5.Checked=true then begin
        post:=post+'--'+boundary+#13+#10+'Content-Disposition: form-data; name=\"make_thumb\"'+#13+#10+#13+#10+'make_thumb'+#13+#10 ;
       end;





     post:=post+'--'+boundary+'--'+#13+#10;
          t:= Length(post);
           // Form4.sMemo3.Text:=Header;


     hhUrl:=InternetConnect(hhInet,PChar(host),INTERNET_DEFAULT_HTTP_PORT,nil,nil,INT ERNET_SERVICE_HTTP,0,0);

     hhRequest:=HttpOpenRequest(hhURL,'POST',pchar(stran),pchar(ht),nil,nil,0,0);

     HttpSendRequest(hhRequest,PChar(Header),Length(Header),PChar(post),t);


    cli:=0;
    stop:=false;
    stream:=TFileStream.Create(extractfilepath(Application.ExeName)+'OtvetZagrImage.html',fmCreate);
    while stop=false do
    begin
    InternetReadFile(hhRequest,@Buf,sizeof(Buf),NumRead);
    Stream.Write(Buf,Numread);
    if Numread=0 then cli:=cli+1;
    if cli>=3 then  stop:=true;
    end;
    stream.Free;
          tex:='';
         att:=TStringStream.Create;
          att.LoadFromFile(extractfilepath(Application.ExeName)+'OtvetZagrImage.html');
    tex:=LowerCase(att.DataString);

     if pos('400 bad reques',LowerCase(tex))<>0 then begin
      Form4.Timer3.Enabled:=true;
     end else begin
    fpr:=AnsiReplaceStr(fpr,'[','');
    fpr:=AnsiReplaceStr(fpr,']','');
      fpr:=AnsiReplaceStr(fpr,'(','');
    fpr:=AnsiReplaceStr(fpr,')','');
    par1:=Copy(tex,pos(LowerCase(fpr)+'<',tex)-150,150);
    par2:=Copy(par1,pos('http',par1),150);
    par3:=Copy(par2,0,pos(fpr,par2)-1+length(fpr));
    if Form5.sComboBox5.ItemIndex=0 then attach:='[thumb]'+par3+'[/thumb]';
    if Form5.sComboBox5.ItemIndex=1 then attach:='[thumb=left]'+par3+'[/thumb]';
    if Form5.sComboBox5.ItemIndex=2 then attach:='[thumb=right]'+par3+'[/thumb]';
    if Form5.sComboBox5.ItemIndex=3 then attach:='<div align=\"center\">[thumb]'+par3+'[/thumb]</div>';
    if Form5.sComboBox7.ItemIndex=0 then attach2:='[thumb]'+par3+'[/thumb]';
    if Form5.sComboBox7.ItemIndex=1 then attach2:='[thumb=left]'+par3+'[/thumb]';
    if Form5.sComboBox7.ItemIndex=2 then attach2:='[thumb=right]'+par3+'[/thumb]';
    if Form5.sComboBox7.ItemIndex=3 then attach2:='<div align=\"center\">[thumb]'+par3+'[/thumb]</div>';
    if par3<>'' then begin
    Form4.sGauge4.Progress:=1;
    Form4.sEdit7.Text:=par3;
    if Form5.sCheckBox7.Checked=true then begin
    Form4.sMemo1.Text:=attach+Form4.sMemo1.Text;
    //
    end;
    if Form5.sCheckBox8.Checked=true then begin
    Form4.sMemo2.Text:=attach2+Form4.sMemo2.Text;
    //Form4.sGauge2.Progress:=1;
    end;
    end;

    Form4.sButton8.Enabled:=true;
     end;

    att.Free;
    ms.Free;

    end;

  • clickmaker © (21.02.13 13:47) [1]
    не наблюдается обработки ошибок и исключений
 
Конференция "Сети" » в Win 8 (64) не отправляет запрос
Есть новые Нет новых   [118475   +36][b:0][p:0.004]