ENC28J60 Ethernet Library V3.3

General discussion on mikroPascal.
Author
Message
Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#61 Post by Loki1_11 » 23 Dec 2008 01:24

Just one more thing, on IE7 its not working, it cannot display the page ...
On Chrome and other it works fine ...

Any tips ?

(Ps.: On my vmware I have an windows xp with ie7 that works I dont know why, but i tested in another 5 machines with xp and IE7 and it didnt works ...

Regards,
Diego.

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#62 Post by Loki1_11 » 25 Dec 2008 14:27

Ok here comes some explanations, after doing a research, I found that the protocol header string (aka httpHeader) should be changed to 'HTTP/1.1 200 OK' + #13 + #10 + 'Content-Type: ';
also all commands that terminate with #10 (Line Feed or LF) should be changed to CR + LF (Carriage Return + Line Feed).
If you try to open up the page with fiddler debuger it will shows that the protocol is missing this things.

After fixed that, I also implemented the Connection: close command before send the content page, or ie wouldnt reconize the end of the page content, it's better to implement the Content-Length: but my implementation is not working yet, I'm new to mikropascal and I miss a lote of features and methods that works diferent in delphi, but I will keep trying.

Another thing, the IE7 for some reason sends the GET / diferent, if you comment the code

Code: Select all

    if(memcmp(@getRequest, @txt, 5)) then    // only GET method is supported here
      begin
        result := 0 ;
        exit;
      end;
It works, so something is wrong here I will reconfigure my ICD to see what is happening.

Until that if some of you guys has some news about it please post it here ;)

Regards,
Diego

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#63 Post by Dany » 25 Dec 2008 19:44

Another thing, the IE7 for some reason sends the GET / diferent, if you comment the code
Hi, I did some tests and the command is indeed different, but not in the "Get" line (the first one):
Mozilla firefox:
GET / HTTP/1.1
Host: 192.168.123.79
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: nl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
IE7.0:
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*
Accept-Language: nl
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Host: 192.168.123.79
Connection: Keep-Alive
And of course IE7 does the job (shows not quite the same as Firefox, but it shows it...)

p.s. adding a #13 or changing a #10 into an #13 does not work for me, neither in Firefox nor in IE7.
Last edited by Dany on 25 Dec 2008 20:38, edited 2 times in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#64 Post by Dany » 25 Dec 2008 20:14

Loki1_11 wrote:Ok after I tryed some combinations using the new rj45 with transformer, It finally worked ;)
Hi Diego, can you share with us please the connections that finally worked? Thanks in advance! :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#65 Post by Loki1_11 » 26 Dec 2008 04:17

Sure I can Dany, just let get into my office so I share with you guys.

So I was reading the http documentation that especifies that the headers should be sended with CR + LF, and the last header (the one that comes before the html text) should have two sequences of CR + LF.

You can download the Fiedler Web Debugger, try to open up your pic web site with it, it will report the protocol errors.

Regards,
Diego.

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#66 Post by Loki1_11 » 26 Dec 2008 04:24

Take a look at http://www.w3.org/Protocols/rfc2616/rfc ... tml#sec6.2

see the first item, "6 Response".

Regards,
Diego ;)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#67 Post by Dany » 26 Dec 2008 10:29

Hi Diego. I will do so. Thanks very much for the documentation. :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#68 Post by yo2lio » 26 Dec 2008 11:09

Diego, I tried this but without any success ...

Code: Select all

const httpHeader : string[42] = 'HTTP/1.1 200 OK'+#10+'Content-type:text/html'+#13+#10 ; // HTTP header
or

Code: Select all

const httpHeader : string[42] = 'HTTP/1.1 200 OK Content-type:text/html'+#13+#10 ; // HTTP header
The only version that work is :

Code: Select all

const httpHeader : string[42] = 'HTTP/1.1 200 OK'+#10+'Content-type:text/html'+#10+#10 ; // HTTP header
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#69 Post by Loki1_11 » 26 Dec 2008 13:09

Hi Yo2lio,
The correct one should be
'HTTP/1.1 200 OK'+ #13 + #10+'Content-Type: text/html'+ #13 + #10;

Here it works fine.

Regards,
Diego

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#70 Post by yo2lio » 26 Dec 2008 13:52

on Firefox ??
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#71 Post by Loki1_11 » 26 Dec 2008 14:23

Yap, on firefox 3.0.4, google chrome 1.0.154.36, ie7 (with some problems comparing the GET method sended by the ie)

Just a note I tryed on Ie7 of 2003 server and it works the get is sended as expected, on ie7 7.0.5730.11 it works fine to but on ie7 7.0.5730.13 the get method comparation doesnt works fine ... I'm searching the reasons ...


Regards,
Diego.

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#72 Post by Loki1_11 » 26 Dec 2008 17:01

I was trying to write two helper functions, but the string concatanation of mikropascal I dont know why doesnt allow me to work as I expected, it doesnt compiles.
So I wrote it in Delphi so if one of you guys can help me porting it to MP.

here comes the functions code, I will post the link to the (delphi project with exe) to download.
Link http://www.unitone.com.br/arquivos/httpUtils.zip

here comes the functions code:


Code: Select all


function ExtractQueryString(str:string; parName: string): string;
var
 i, i1: word;
 tmpStr: string;
 bFoundedPar: byte;
begin
 bFoundedPar := 0;
 result := '';
 for i:= 1 to Length(str) do
  begin
    if (str[i] = '?') or (str[i] = '&') then
     begin
       for i1 := i+1 to Length(str) do
        begin
          if (bFoundedPar = 0) and (str[i1] = '=') then
           begin
            tmpStr := '';
            Break;
           end;

          if (bFoundedPar = 1) and (str[i1] = '=') then
           Continue;

          if bFoundedPar = 0 then
           begin
            tmpStr := tmpStr + str[i1];

            if tmpStr = parName then
             begin
              bFoundedPar := 1;
              tmpStr := '';
             end;
           end
            else
             begin
               if (str[i1] <> '?') and (str[i1] <> '&') and (i1 <= Length(str)) then
                begin
                 tmpStr := tmpStr + str[i1];
                end
                 else
                  begin
                    result := tmpStr;
                    exit;
                  end;
             end;
        end;
     end
      else
       Continue;
  end;
  if (tmpStr <> '') and (bFoundedPar = 1) then
   Result := tmpStr;
end;

function ExtractPageName(str: string; pageExtensions: string): string;
var
  I: Integer;
  tmpStr: String;
  tmpExtension: String;
  bFoundedExtension: byte;
  I1: Integer;
begin
 bFoundedExtension := 0;
 for I := 1 to Length(str) do
  begin
   if str[I] = '/' then
    begin
      for I1 := I+1 to Length(str) do
       begin
         if str[I1] = '.' then
          begin
           bFoundedExtension := 1;
           Continue;
          end;

         if bFoundedExtension = 0 then
          tmpStr := tmpStr + str[I1] else
          tmpExtension := tmpExtension + str[I1];

         if tmpExtension = pageExtensions then
            Result := tmpStr+'.'+tmpExtension;
       end;
    end;
  end;
end;

Regards,
Diego.

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#73 Post by Loki1_11 » 26 Dec 2008 17:16

Dany I forgot to post the pin connections for rj45 with transformer that I have, so here comes:

RJ45Pins

1 = CT RX
2 = RX-
3 = RX+
4 = NC (No Connection)
5 = NC (No Connection)
6 = CT TX
7 = TX+
8 = TX-

Regards,
Diego

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#74 Post by Loki1_11 » 30 Dec 2008 18:01

Can you guys take a look at http://unitonedev.no-ip.org:8020 ?

Take a look if it will open everthing ok, and please if possible post the results for me, like browser name + version, and OS version.

I'm trying to fix some other things in this prog.

Kindly Regards, and happy new year :D
Diego.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#75 Post by Dany » 30 Dec 2008 18:06

Loki1_11 wrote:Can you guys take a look at http://unitonedev.no-ip.org:8020 ?

Take a look if it will open everthing ok, and please if possible post the results for me, like browser name + version, and OS version.

I'm trying to fix some other things in this prog.

Kindly Regards, and happy new year :D
Diego.
Hi Diego, I get a network timeout both in Firefox and IE7. :cry:
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal General”