HTTP – протокол и CGI. Запросы и ответы Запрос = Строка-Статус *(Общий-Заголовок | Заголовок- Запроса | Заголовок-Содержания ) CRLF [ Содержание-Запроса.

Slides:



Advertisements
Similar presentations
HTTP HyperText Transfer Protocol. HTTP Uses TCP as its underlying transport protocol Uses port 80 Stateless protocol (i.e. HTTP Server maintains no information.
Advertisements

HTTP – HyperText Transfer Protocol
Web basics HTTP – – URI/L/Ns – HTML –
Lecture 7, : The Internet, Summer : The Internet Lecture 7: Web Services I David O’Hallaron School of Computer Science and Department.
How does the server format the information it gives to the appln program? As environment variables and in standard input.
Configuring Apache Server and Perl for CGI T.A. Maisa Khudair Dr. Qusai Abu Ein.
CS320 Web and Internet Programming Generating HTTP Responses
16-Jun-15 HTTP Hypertext Transfer Protocol. 2 HTTP messages HTTP is the language that web clients and web servers use to talk to each other HTTP is largely.
Application Layer Socket API, HTTP, VoIP, DNS IS250 Spring 2010 John Chuang.
CGI. XML2 Common Gateway Interface n Georgia Tech 1995 Web Usage Survey –Perl % –C % –Shell Scripts - 8.1% –Tcl - Tool Commercial Language.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
HTTP Headers. Read these slides yourselves This set of slides explains the header fields which are pre-defined in HTTP/1.1 Read these slides yourselves.
How the web works: HTTP and CGI explained
The abs_path in a URI If the abs_path is not present in the URL, it must be given as "/" in a Request-URI for a resource. Thus, if a user points a browser.
Data and Computer Communications Eighth Edition by William Stallings Lecture slides by Lawrie Brown Chapter 23 – Internet Applications Internet Directory.
Web Services Nov 26, 2002 Topics HTTP Serving static content Serving dynamic content class27.ppt “The course that gives CMU its Zip!”
Outcomes Know what are CGI Environment Variables Know how to use environment variables How to process A simple Query Form Able to use URL Encoding rules.
CS 142 Lecture Notes: HTTPSlide 1 HTTP Request GET /index.html HTTP/1.1 Host: User-Agent: Mozilla/5.0 Accept: text/html, */* Accept-Language:
The abs_path in a URI If the abs_path is not present in the URL, it must be given as "/" in a Request-URI for a resource. Thus, if a user points a browser.
Hypertext Transport Protocol CS Dick Steflik.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
University of Calgary – CPSC 441 Parts of these slides are courtesy of Erich Nahum (IBM Research)
Common Gateway Interface
Web technologies and programming cse hypermedia and multimedia technology Fanis Tsandilas April 3, 2007.
Overview A plain HTML document is static A CGI program is executed in real-time, so that it can output dynamic information. CGI (Common Gateway Interface)
CP3024 Lecture 3 Server Side Facilities. Lecture contents  Server side includes  Common gateway interface (CGI)  PHP Hypertext Preprocessor (PHP) pages.
COMP3016 Web Technologies Introduction and Discussion What is the Web?
Java Technology and Applications
HTTP Protocol Specification
HTTP HTML Introduction to web development. elaborate SPARCS 07 Wheel Moodle TA 안병욱 CS101 TA The presenter is 바퀴짱 ? 3 월 신작 ? 밤의 제왕 ? 악명 높은 TA?
HTTP Reading: Section and COS 461: Computer Networks Spring
1 Lecture #7-8 HTTP – HyperText Transfer Protocol HAIT Summer 2005 Shimrit Tzur-David.
1 HTTP Messages Herng-Yow Chen. 2 Outline The Flow of Messages The Parts of a Message The various methods that request message support The various status.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
Application Layer 2 Figures from Kurose and Ross
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
Sistem Jaringan dan Komunikasi Data #9. DNS The Internet Directory Service  the Domain Name Service (DNS) provides mapping between host name & IP address.
Browser Web Server Users DB 2a. Redirect to login page plugin 1. access a protected page Login Web Server (https) aislogin.cern.ch edh.cern.ch 3a. Set.
Web Services Topics HTTP Serving static content
WebServer A Web server is a program that, using the client/server model and the World Wide Web's Hypertext Transfer Protocol (HTTP), serves the files that.
Web Server Design Week 14 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/14/10.
The HyperText Transfer Protocol. History HTTP has been in use since 1990 (HTTP/0.9) HTTP/1.0 was defined in RFC 1945 (May 1996) and included metainformation.
CSCE Systems Programming Lecture 21 Web Server: CGI -Dynamic Pages CSCE March 25, 2013.
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
CGI programming Peter Verhás January What this tutorial is about Introduction to CGI programming Using ScriptBasic –Simple to program –Simple to.
Web Server Design Week 8 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 3/3/10.
HyperText Transfer Protocol (HTTP) RICHI GUPTA CISC 856: TCP/IP and Upper Layer Protocols Fall 2007 Thanks to Dr. Amer, UDEL for some of the slides used.
HTTP1 Hypertext Transfer Protocol (HTTP) After this lecture, you should be able to:  Know how Web Browsers and Web Servers communicate via HTTP Protocol.
1-1 HTTP request message GET /somedir/page.html HTTP/1.1 Host: User-agent: Mozilla/4.0 Connection: close Accept-language:fr request.
Form Data Encoding GET – URL encoded POST – URL encoded
Internet and Intranet Fundamentals
HTTP Protocol Design1 HTTP - timeline r Mar 1990 CERN labs document proposing Web r Jan 1992 HTTP/0.9 specification r Dec 1992 Proposal to add MIME to.
Copyright © 2002 ProsoftTraining. All rights reserved. Java Servlets.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
Web Services November 30, 2004 Topics HTTP Serving static content Serving dynamic content “The course that gives CMU its Zip!” class26.ppt.
JavaScript, Part 4 Instructor: Charles Moen CSCI/CINF 4230.
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
Krerk Piromsopa. 1 Department of Computer Engineering. Chulalongkorn University. Web Application Generic Issues.
Overview of Servlets and JSP
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
Web Server Design Assignment #5: Unsafe Methods & CGI Due: 05/05/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
Data and Computer Communications Eighth Edition by William Stallings Lecture slides by Lawrie Brown Chapter 23 – Internet Applications Internet Directory.
Introduction to CGI PROG. CGI stands for Common Gateway Interface. CGI is a standard programming interface to Web servers that gives us a way to make.
DEV336. demo HTTP Packet Trace GET / HTTP/1.1 Accept: text/html, application/xhtml+xml, */* Accept-Language: en-US User-Agent: Mozilla/5.0 (compatible;
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 04/03/12.
Web Server Design Week 15 Old Dominion University Department of Computer Science CS 495/595 Spring 2009 Michael L. Nelson 4/20/09.
Web Server Design Assignment #5: Unsafe Methods & CGI
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
Environment Variables
Web Server Design Week 16 Old Dominion University
Presentation transcript:

HTTP – протокол и CGI

Запросы и ответы Запрос = Строка-Статус *(Общий-Заголовок | Заголовок- Запроса | Заголовок-Содержания ) CRLF [ Содержание-Запроса ] Ответ = Строка-Статус *(Общий- Заголовок | Заголовок-Ответа | Заголовок-Содержания) CRLF [ Содержание-Ответа ]

Общий Заголовок Общий-Заголовок = Cache-Control: Connection: Date: MIME-Version: Pragma: Transfer-Encoding: Upgrade: Via:

Заголовок Connection Значения параметра Connection: Close Keep-Alive Постоянные соединения ( Persistent Connections) Позволяет запрашивать и получать несколько файлов за одно TCP-соединение И клиент и сервер могут прервать соединение. Для того, чтобы известить, что соединение будет прервано, они могут послать Close в значении параметра Connection

Запрос Строка-Статус = Метод SP URI- Запроса SP Версия-HTTP CRLF Заголовок-Запроса = Accept: Accept-Charset: Accept-Encoding: Accept-Language: Authorization: Cookie: From: Host: If-Modified-Since: Max-Forwards: Pragma: Proxy-Authorization: Range: Referer: User-Agent: extension-header

Методы GET – основной для простых запросов данные добавляются к адресу POST – для посылки данных HEAD – для запроса метаданных Условный GET – используется If-Modified-Since Упоминаются: PUT LINK UNLINK DELETE

Ответ Server: Set-Cookie: Vary: Warning: WWW-Authenticate: extension-header Строка-Статус = Версия-HTTP SP Статус-Код SP Фраза-Объяснение Заголовок-Ответа = Accept-Ranges: Age: Proxy-Authenticate: Public: Retry-After:

Ответ Accept-Ranges служит для передачи файла по частям (докачки). Значения: bytes – весь файл n:m – кусок с байта n длиной m none – докачка не поддерживается Retry-After – когда сервер «говорит», что сервис временно недоступен (503) Proxy-Authenticate – запрос авторизованного доступа Vary – при передаче одной из версий ресурса. Указываются параметры различия.

Заголовок-Содержания Заголовок-Содержания = Allow: Content-Base: Content-Encoding: Content-Language: Content-Length: Content-Transfer-Encoding Content-Type: Derived-From: Expires: Last-Modified: Link: Location: URI:

Статус код 1** – информация 2** – успешный ответ 3** – редирект 4** – ошибка запроса 5** – ошибка сервера

Статус коды 100 Continue 200 OK 301 Moved Permanently 302 Moved Temporarily 304 Not Modified 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 500 Internal Server Error 503 Service Unavailable

Необязательная часть Пример запроса GET /index.html HTTP/1.0 User-Agent: Mozilla/2.02Gold (WinNT; I) Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

Пример ответа HTTP/ OK Date: Fri, 20 Sep :17:58 GMT Server: NCSA/1.5.2 Last-modified: Mon, 17 Jun :53:08 GMT Content-type: text/html Content-length: 2482

Cookie Set-Cookie: name=value; – минимальная форма Set-Cookie: name=value; expires=date; path=pathname; domain=domain- name; secure – полная форма

Пример Cookie Set-Cookie: username=guest; expires=Monday, 31-Dec :59:59 GMT; path=/; domain=

CGI – Common Gateway Interface серверклиент CGI-программа WWW-сервер браузер HTML- документ шлюз База данных

Переменные окружения AUTH_TYPE CONTENT_LENGTH CONTENT_TYPE DOCUMENT_ROOT GATEWAY_INTERFACE HTTP_ACCEPT HTTP_FROM HTTP_REFERER HTTP_USER_AGENT PATH_INFO PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST REMOTE_IDENT REMOTE_USER REQUEST_METHOD SCRIPT_NAME SERVER_NAME SERVER_PORT SERVER_PROTOCOL SERVER_SOFTWARE

Переменные окружения CONTENT_LENGTH – длина данных запроса HTTP_COOKIE – cookie HTTP_REFERER – адрес ссылки QUERY_STRING – запрос (GET) REMOTE_ADDR – ip клиента REMOTE_HOST REQUEST_METHOD – метод

Заголовки, обрабатываемые сервером Content-type Set-Cookie Location Примеры: Content-type: text/html «текст» Content-type: text/html Set-Cookie: username=guest; «текст» Set-Cookie: username=guest; Location: