Article View: pl.comp.www.server-side
Article #61471Re: Dziwne requesty
From: Grzegorz Staniak
Date: Tue, 06 Aug 2013 01:54
Date: Tue, 06 Aug 2013 01:54
83 lines
4042 bytes
4042 bytes
On 05.08.2013, marek.horodyski@gmail.com <marek.horodyski@gmail.com> wrote: > Wg RFC powiniem odpowiedzieć : > HEAD > > The HEAD method is identical to GET except that the server MUST NOT > return a message-body in the response. The metainformation contained > in the HTTP headers in response to a HEAD request SHOULD be identical > to the information sent in response to a GET request. This method can > be used for obtaining metainformation about the entity implied by the > request without transferring the entity-body itself. This method is > often used for testing hypertext links for validity, accessibility, > and recent modification. > > The response to a HEAD request MAY be cacheable in the sense that the > information contained in the response MAY be used to update a > previously cached entity from that resource. If the new field values > indicate that the cached entity differs from the current entity (as > would be indicated by a change in Content-Length, Content-MD5, ETag > or Last-Modified), then the cache MUST treat the cache entry as > stale. > > Problem w tym, że RFC nie podaje przykładowego żądania i poprawnej nań > odpowiedzi, czego mi najbardziej brakuje. Przecież będą dokładnie takie same jak dla GET, tylko bez wysyłania treści zasobu. > Wygląda, że odpowiedź powinna wyglądać : > > HTTP/1.0 200 OK > X-Powered-By: Harbour 3.2.0dev (r1304301343)/MinGW GNU C 4.6.1 (32-bit) > Cache-Control: no-cache > Server: homar.exe > Content-Type: text/html > Connection: Close > Keep-Alive: timeout=15 > Date: Mon, 05 Aug 2013 08:54:25 GMT > Content-Length: 0 Content-length albo podajesz takie "jakie by było" gdybyś wysyłał treść, albo omijasz (np. dla zasobów generowanych dynamicznie, dla których nie może być z góry znane). Czyli nie "0". > albo przynajmniej tak mi się wydaje. Wobec tego dopisałem w kodzie metodę : > > switch server[ as_http[ 10]] > case "HEAD" > exit // powinno pójść domyślne 200 w odpowiedzi i pusta strona - do TESTU! > case "GET" > case "POST" > > I teraz ważne pytanie : JAK TO PRZETESTOWAĆ ? > Jak ze strony klienta wygenerować takie żądanie, abym mógł sprawdzić > co serwer zrobi ? A choćby i ręcznie: [~]$ telnet www.onet.pl 80 Trying 213.180.141.140... Connected to www.onet.pl. Escape character is '^]'. HEAD / HTTP/1.1 Host: www.onet.pl Connection: close HTTP/1.1 200 OK server: edgeserver content-length: 117325 content-type: text/html; charset=utf-8 cache-control: private pragma: no-cache Connection: close Connection closed by foreign host. Albo poszukaj sobie jakiegoś narzędzia, np. czegoś stąd: http://stackoverflow.com/questions/1976442/how-do-i-send-a-head-request-manually-using-firefox GS -- Grzegorz Staniak <gstaniak _at_ gmail *dot* com>
Technical Details
Message-ID:
<slrnl00l66.haq.wytnij-to_gstaniak@inka.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mailReferences:
<fefdc1fb-b20b-4ba6-90ea-c39bbcb8ac5c@googlegroups.com> <slrnkvq56d.cj8.wytnij-to_gstaniak@inka.pl> <b460f36e-bc57-4312-9d3d-6209bf47ee8d@googlegroups.com> <slrnkvt1u7.tti.wytnij-to_gstaniak@inka.pl> <0e0fe4d4-c68f-4135-92b8-6b63cb90fc88@googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mail From: Grzegorz Staniak <wytnij-to_gstaniak@gmail.com> Newsgroups: pl.comp.www.server-side Subject: Re: Dziwne requesty Date: Tue, 6 Aug 2013 01:54:35 +0000 (UTC) Organization: Disorganization Inc. Lines: 83 Message-ID: <slrnl00l66.haq.wytnij-to_gstaniak@inka.pl> References: <fefdc1fb-b20b-4ba6-90ea-c39bbcb8ac5c@googlegroups.com> <slrnkvq56d.cj8.wytnij-to_gstaniak@inka.pl> <b460f36e-bc57-4312-9d3d-6209bf47ee8d@googlegroups.com> <slrnkvt1u7.tti.wytnij-to_gstaniak@inka.pl> <0e0fe4d4-c68f-4135-92b8-6b63cb90fc88@googlegroups.com> NNTP-Posting-Host: 77-254-244-218.adsl.inetia.pl Mime-Version: 1.0 X-Trace: mx1.internetia.pl 1375754075 20598 77.254.244.218 (6 Aug 2013 01:54:35 GMT) X-Complaints-To: abuse@inetia.pl NNTP-Posting-Date: Tue, 6 Aug 2013 01:54:35 +0000 (UTC) X-Tech-Contact: usenet@internetia.pl User-Agent: slrn/1.0.1 (Linux) X-Server-Info: http://www.internetia.pl/ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit