Autor Beitrag
Sauger Chris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 228

Win XP, Linux SuSE 9.2
Delphi 4,Delphi 7 Ent.
BeitragVerfasst: So 02.05.10 12:57 
moin und zwar hab ich ein kleines problem :(
wieso wird das request nicht vom server akzeptiert ??
beim sniffen bekomm ich das hier raus
(muss leider sniffen da die ausgabe (buf) nur ?? und umlaute ausgibt und in vcl chinesische zeichen oO)

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
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:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Cannot process request!</title>
<link rev="made" href="mailto:postmaster@localhost" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/ 
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
/*]]>*/--></style>
</head>

<body>
<h1>Cannot process request!</h1>
<p>


    The server does not support the action requested by the browser.
   
</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.

</p>

<h2>Error 501</h2>
<address>
  <a href="/">localhost</a>
  
  <span>02.05.2010 12:50:56
  Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1</span>
</address>
</body>
</html>



ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
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:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
program Project1;

{$APPTYPE CONSOLE}

uses
  windows,
  winsock;

// aus WinSock2
type WSAevent=THandle;
function WSACreateEvent:WSAEvent;stdcall;
external 'ws2_32.dll' name 'WSACreateEvent';
function WSACloseEvent(hEvent:WSAevent):bool;stdcall;
external 'ws2_32.dll' name 'WSACloseEvent';
function WSAResetEvent(hEvent: WSAEvent):bool;stdcall;
external 'ws2_32.dll' name 'WSAResetEvent';
function WSAEventSelect(s:TSocket;hEventObject:WSAevent;lNetworkEvents:LongInt):Integer; stdcall;
external 'ws2_32.dll' name 'WSAEventSelect';
function WSAWaitForMultipleEvents(cEvents:DWord;
                                  lphEvents:Pointer;
                                  fWaitAll:bool;
                                  dwTimeOUT:DWord;
                                  fAlertable:bool):DWord;stdcall;
external 'ws2_32.dll' name 'WSAWaitForMultipleEvents';




var
  SockAddr1:TSockAddr;


const WSA_WAIT_EVENT_0 = WAIT_OBJECT_0;


procedure main;
var wsaData:TwsaData;
    SockEvent:WSAEvent;
    Socket1:TSocket;
    WSAresult:Integer;
    buf:array[0..511of char;
    s:string;
begin
  WSAStartUp(MakeWord(2,0),WSAData);

  Socket1:=Socket(af_Inet,Sock_Stream,IPProto_TCP);
  Connect(Socket1,SockAddr1,sizeof(TSockAddr));
  SockEvent:=WSACreateEvent;
  WSAEventSelect(Socket1,SockEvent,FD_Read);

s:='GET /index.php?name=ddd HTTP/1.1'+#13#10+
'Host: 127.0.0.1'+#13#10+
'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3'+#13#10+
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'+#13#10+
'Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3'+#13#10+
'Accept-Encoding: gzip,deflate'+#13#10+
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7'+#13#10+
'Keep-Alive: 115'+#13#10+
'Connection: keep-alive'+#13#10#13#10;

  send(Socket1,s[1],length(s),0);
  repeat
    WSAResult:=WSAWaitForMultipleEvents(1,@SockEvent,false,infinite,false);
    case WSAResult of
      WSA_WAIT_EVENT_0 : begin
        fillchar(buf,sizeof(buf),0);
        recv(Socket1,buf,512,0);
        write(buf);
      end;
      else
        break;
    end;
    WSAresetEvent(SockEvent);
  until false;


  WSACloseEvent(SockEvent);
  WSACleanUp;
end;

begin
SockAddr1.sin_family := af_Inet;
sockaddr1.sin_port := $5000;  //port 80
sockaddr1.sin_addr.S_addr := $*****; //meine ip zensiert ;)
main;
end.


das komische ist halt s ist der inhalt wie es mein firefox sendet :( ka wo der fehler liegt


danke schon mal für eure hilfe =)
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: So 02.05.10 16:26 
Ich versuch mal zu Antworten.

Was mir auffällt ist
ausblenden Delphi-Quelltext
1:
s:='GET /index.php?name=ddd HTTP/1.1'+#13#10+'Host: 127.0.0.1'+#13#10+......					

Versuche mal nur
ausblenden Delphi-Quelltext
1:
s:='GET /index.php HTTP/1.1'+#13#10+'Host: 127.0.0.1'+#13#10+......					

um zu sehen ob Du überhaupt auf die Seite kommst.
Weiter sehe ich das
ausblenden Delphi-Quelltext
1:
send(Socket1,s[1],length(s),0);					

müsste es nicht so sein?
ausblenden Delphi-Quelltext
1:
send(Socket1,s,length(s),0);					

Aber ist mehr eine vermutung! Genauer verstehe ich es leider nicht was Du da machst!

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!