Examples of HTTP 1.1 Requests and Responses

This section provides some tutorial examples of HTTP 1.1 requests and responses. Real examples from perl.org and w3.org Web sites are included.

Let's use my Perl socket test program to send HTTP 1.1 requests to some popular Web servers.

HTTP 1.1 request requires the "Host" header line. I need to create a new request file with an extra line, http_1_1_get.req. Don't forget to have 2 new line (\n) characters to end the file.

GET / HTTP/1.1
Host: www.perl.org

Here is my test with www.perl.org:

\herong>SocketRequestResponse.pl www.perl.org 80 http_1_1_get.req

\herong>type http_get.res
HTTP/1.1 200 OK
Date: ... 2009
Server: Apache/1.3.33 (Unix) mod_perl/1.29
P3P: CP="NOI DEVo TAIo PSAo PSDo OUR IND UNI NAV", policyref="/w3c...
Last-Modified: ... 2009
Content-Length: 14341
Content-Type: text/html; charset=utf-8
Via: 1.1 combust.perl.org
Vary: Accept-Encoding

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"...
    <title>The Perl Programming Language - www.perl.org</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf...
	<link type="text/css" rel="stylesheet" href="/css/leostyle...
	<link type="text/css" rel="stylesheet" href="/css/site.css...

    <meta name="description" content="The Perl Programming Languag...

My second test is www.w3.org:

\herong>type http_1_1_get.req
GET / HTTP/1.1
Host: www.w3.org

\herong>SocketRequestResponse.pl www.w3.org 80 http_1_1_get.req

\herong>type http_get.res
HTTP/1.1 200 OK
Date: ... 2009
Server: Apache/2
Content-Location: Home.html
Vary: negotiate,accept
TCN: choice
Last-Modified: ... 2009
ETag: "6edd-47b73401de880;89-3f26bd17a2f00"
Accept-Ranges: bytes
Content-Length: 28381
Cache-Control: max-age=600
Expires: ... 2009
P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
Connection: close
Content-Type: text/html; charset=utf-8

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://w...
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"...
<!-- Generated from data/head-home.php, ../../smarty/{head.tpl} --...
<title>World Wide Web Consortium (W3C)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"...
<link rel="Help" href="/Help/" />
<link rel="stylesheet" href="/2008/site/css/minimum" type="text/cs...
<style type="text/css" media="print, screen and (min-width: 481px)...
<link href="/2008/site/css/minimum" rel="stylesheet" type="text/cs...
<meta name="viewport" content="width=320" />

Last update: 2009.

Table of Contents

 About This Book

 Introduction to Web Service

 Introduction to SOAP (Simple Object Access Protocol)

 SOAP Message Structure

 SOAP Message Transmission and Processing

 SOAP Data Model

 SOAP Encoding

 SOAP RPC Presentation

 SOAP Properties Model

 SOAP Message Exchange Patterns

 SOAP HTTP Binding

 SOAP Perl Implementations

 SOAP PHP Implementations

 SOAP Java Implementations

 Perl SOAP::Lite - SOAP Server-Client Communication Module

Perl Socket Test Program for HTTP and SOAP

 SocketRequestResponse.pl - Socket Level Testing Program

 Examples of HTTP 1.0 Requests and Responses

Examples of HTTP 1.1 Requests and Responses

 SOAP 1.1 Request - Content-Length Too Small

 SOAP 1.1 Request - Content-Length Too Large

 SOAP 1.1 Request and Response of GetSpeech

 SOAP 1.2 Request and Response of GetSpeech

 Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service

 Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services

 Perl SOAP::Lite 0.710 for WSDL

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 Java Socket and HttpURLConnection for SOAP

 SAAJ - SOAP with Attachments API for Java

 SoapUI - SOAP Web Service Testing Tool

 WS-Security - SOAP Message Security Extension

 WS-Security X.509 Certificate Token

 Web Services and SOAP Terminology


 PDF Printing Version