`
`Covers HTTP/1.1
`
`”MANNDNG _
`
`001
`
`US. Patent No. 8,724,622
`
`Apple Inc.
`APL1115
`
`001
`
`Apple Inc.
`APL1115
`U.S. Patent No. 8,724,622
`
`
`
`Illustrated Guide
`
`to HTTP
`
`PAUL S. HETHMON
`I!
`
`MANNING
`
`Crccnwich
`
`(74" w. long.)
`
`002
`
`002
`
`
`
`For electronic browsing and ordering ol‘this book. See htt|1:H\\W.browscbtmksxom.
`
`The publisher offers discounts on this lmok when ordered in quantity. For more
`information. please contact:
`
`Special Sales Depart Inent
`Manning Publications Co.
`3 Lewis Street
`
`Greenwich. CT 06830
`
`Fax:(203}66l—9018
`Email:ordcrs@manning.com
`@1997 by Manning Publications Co. All rights reserved.
`
`.
`
`(9/! 1’6
`
`. ’76
`
`' H W’- H 94 96¢
`
`f 9 9 ’7
`MEffi
`
`No part of this publication may be reproduced. stored in a retrieval system. or
`transmitted. in any Form or by means electronic. mechanical. photocopying. or
`otherwise. without prior written permission oF the publisher.
`
`6 Recognizing the importance of preserving what has been written. it is
`Manning's policy to have the books it publishes printed on acid-Free paper. and
`we exert our best eFForts to that end.
`
`Many of the designations used by manufacturers and sellers to distinguish their
`products are claimed as trademarks. Where those designations appear in die book.
`and Manning Publications was aware ofa trademark claim. the designations have
`been printed in initial caps or all caps.
`
`Library of Congress Cataloging—in-Publication Dam
`Hethmon. Paul S.
`
`illustrated guide to HTTP 1" Paul S. Hethn‘ton.
`p.
`cm.
`
`Indudes bibliographical refrenoes and index.
`ISBN 1-384777-37-6
`
`l. Hypertext systems. 2. H] 11’ {Computer nemork protocol}
`I. Title.
`QA76.76.H94H434 1997
`004.6'2—dc21
`
`974596
`crp
`
`M Manning Publications Co.
`3 Lewis Street
`Greenwich. CT 06830
`
`Copyeditor: Maggie Mitchell
`Typesetter: Dorothy Martian
`Cover designer: Leslie Haimee
`
`Printed in the United States ofAmei-iea
`12345678910—CR—00999897
`
`003
`
`003
`
`
`
`COfltEflZ'S
`
`
`preféee
`
`xii
`
`acknowledgm mo xr'v
`
`1
`
`Introduction I
`
`1.1
`
`Is this book For you? 2
`
`1.2 Required background 3
`L3 The material 4
`
`1.4 Finishing 6
`
`2 HTTP overview 7
`
`2.1 What is the World Wide Web? 8
`The clientfserver modei 8
`
`2.2 General operation 10
`
`2.3 Abitofhisrory 12
`HTTWOB 12, WILD 13
`
`2.4 HTTPHJ 16
`
`Persistent connections 18.
`New request methods 1?.
`Chunked encoding l9. Byte range operations 20,
`Content negotiation 20. Digest Authentication 2!.
`Caching 22
`
`2.5 Finishing 24
`
`mi
`
`004
`
`004
`
`
`
`(TON TEN T5
`
`
`3 Basic HTTP—symax and semantics 25
`3.1
`
`Terminology 26
`
`3.2
`
`3.3
`
`3.4
`
`Protocol syntax 31
`
`The basic grammar 33
`
`Basic HTTP concepts 34
`HTTP version 34. Uniform Resource Identifiers 35.
`
`Formats for date and time 38. Code: date handling 39.
`Character sets 4}. Content codings 42. Transfer
`codings 43. Code: chunked encoding 44. Media
`types 47.
`Product tokens 49. Quality values 49.
`Languagetags 50. Entirytags 50. Range units 51
`
`3.5
`
`Finishing 52
`
`4' The request 53
`4.1
`
`The Request Message 54
`Method definitions 55
`The OPTIONS method 55, The GET method 56. The
`HEAD method 57. The POST method 58. The PUT
`method 59. The DELETE method 60. The TRACE
`method 60
`
`4.2
`
`4.3
`
`4.4
`
`4.5
`
`viii
`
`The request header fields 61
`Accept 6]. Accept-Charm 62. Accept—Encoding 62,
`Accept-Language 62. Authorization 63. Code:
`Base64 64.
`From 67. Host 67.
`If—Modified—Since G7,
`IF—Mateh 63.
`lF—None-Match 68.
`[feRartge 69,
`If-Unmodified-Since 69. Max—Fomards 69,
`Proxy-Authorization 70. Range 70. Referet 71.
`User-Agent 7'!
`
`Implementation 71
`GET and. HEAD 72. POST 7B. PUT 30,
`DELETE 8]. OPTIONS 31, TRACE 82
`
`Finishing 83
`
`005
`
`005
`
`
`
`
`
`(IONTENTS
`——.————————"
`
`5 Entity andgeneral headers, and cache-(antral 84
`
`5.] The entity headers 85
`Allow 85. Content-Base 85, Content-Encoding 86
`Content-Language 86. Content-Length 36.
`Content—Location 87. Content—MUS 87.
`
`Content-Range 87. Content-Type 88. ETag 88.
`Last-Modified 88
`
`5.2 The general headers 88
`Pragma 89.
`Connection 89. Date 89.
`Transfer—Encoding 8‘). Upgrade 90. Via 90
`
`5.3 Cache-Control 91
`What is cachable? 93. Age 93. Cache-Control 94.
`Expires 95. Warning 95. Cache operation 96.
`Expiration of responses 99.
`Fresh and stale
`responses 100, Validatiuga response 101.Examp1es 103
`
`5.4 Finishing 105
`
`6 The response 106
`
`6.1 The response message 107
`
`6.2 The response header fields 11 1
`Accept-Ranges 112. Authentication-info 112,
`Location 113.
`Proxy-Authenticate 113,
`Proxy-Authenticare-info 113,
`Public 113.
`Retry—After 114,
`Server 114. Vary 114.
`Warning 114. WWW-Authenticate 115, Code: Digest
`Access Authentication 115
`
`6.3 Digesr Access Authentication 117
`
`6.4 Implementation 121
`GET and HEAD 121. GET and byte range
`requests 124. GET and content negotiation 126
`
`6.5 Finishing 127
`
`006
`
`006
`
`
`
`(TON TEN TS
`
`
`7 Socket: 128
`
`7.1
`
`7.2
`
`7.3
`
`7.4
`
`7.5
`
`7.6
`
`7.7
`
`7.8
`
`7.9
`
`7.10
`
`7.1 I
`
`The socket 12‘)
`
`Setting up the server socket 130
`
`Setting up the client socket 134
`Data transmission 1313
`
`Utility routines 144
`Host name and address routines 144
`
`NT specifics 146
`
`08.12 specifics 147
`The socket class 149
`
`The socket class methods 154
`
`Finishing 173
`
`8
`
`The HTTP/1.1 server 174
`
`8.1
`
`8.2
`
`8.3
`
`8.4
`
`8.5
`
`8.6
`
`8.7
`
`8.8
`
`8.9
`
`8.10
`
`8.11
`
`8.12
`
`8.13
`
`8.14
`
`8.15
`
`The configuration file 175
`
`The main program 179
`The server 183
`
`The authorization model 187
`
`RequeSt and response headers 189
`HTTP! 1.1 216
`
`Finding the method 224
`TRACE 225
`
`OPTIONS 229
`
`PUT 230
`
`If funetions 238
`
`Chunked encoding 242
`The DELETE method 247
`
`GET the document 254
`
`Checking the If-Range 265
`
`007
`
`007
`
`
`
`(If) N TEN TS
`
`
`8.16 Transmission ufbyu: ranges 267
`
`8.17 Finishing 274
`
`9 Common Gateway Inrewfizce support 275
`9.1 Basic functions 276
`
`9.2 Executing the CGI program 287
`9.3 The OSJ’Z version 289
`
`9.4 The Windows version 299
`
`9.5 Finishing 308
`
`appendix A HTTP syntax 309
`
`appendix B HTTP header-field dqgniriom 321
`
`gi’orrmy 370
`
`éibi'z'ogmp/Jy 372
`index 373
`
`008
`
`008
`
`