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_perl.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. It used to be working in 2009. But now it is not responding. I have to break the call with <Ctrl-C>:

herong> perl SocketRequestResponse.pl www.perl.org 80 \ 
   http_1_1_get_perl.req http_get.res

<Ctrl-C>

My second test is www.w3.org. I used to be working in 2009. But now it is returning the 400 error:

herong> more http_1_1_get_w3.req
GET / HTTP/1.1
Host: www.w3.org

herong> SocketRequestResponse.pl www.w3.org 80 \
   http_1_1_get_w3.req http_get.res

herong> more http_get.res
HTTP/1.1 400 Bad Request
Last-Modified: Thu, 09 Jan 2014 21:28:13 GMT
ETag: "434-4ef90496c3540"
Accept-Ranges: bytes
Content-Length: 1076
Vary: upgrade-insecure-requests
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en">
<head>
<title>Error 400</title>

Looks like my request is missing some required headers.

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 MEP (Message Exchange Patterns)

 SOAP HTTP Binding

 SOAP PHP Implementations

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 PHP SOAP Web Service Example - getTemp

 SOAP Perl 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 GetTemp

 SOAP 1.2 Request and Response of GetTemp

 Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service

 Perl SOAP::Lite for SOAP 1.2 Web Services

 Perl SOAP::Lite for WSDL

 Python SOAP Client: Zeep

 SOAP Java Implementations

 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

 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

 Web Services and SOAP Terminology

 Archived Tutorials

 References

 Full Version in PDF/EPUB