IT代考 Appendix: Formal specifications

Appendix: Formal specifications

HTTP Response := StatusLine + ResponseHeaderLines + EmptyLine + Exact file content

Copyright By PowCoder代写 加微信 powcoder

– StatusLine := “HTTP/1.0 200 OK\r\n” | “HTTP/1.0 404 Not Found\r\n”

| “HTTP/1.0 400 Bad Request\r\n”

– Header lines

o ResponseHeaderLine := FieldName + “: ” + FieldValue + “\r\n”

o ResponseHeaderLines := ResponseHeaderLine*

 Star (*) means the header line may occur zero or more times

o FieldName is case insensitive

o ResponseHeaderLine Examples:

 VALID: “Connection: keep-alive\r\n”

 VALID: “connEctIoN: close\r\n” (the field name is case insensitive)

– EmptyLine := “\r\n”

– Exact file content (Don’t append a line break)

HTTP GET Request := RequestLine + RequestHeaderLines + EmptyLine

– RequestLine := “GET ” + Path + “ HTTP/1.0” + ENDL

o Spaces!!

o RequestLine Examples:

 “GET /LargeFile.html HTTP/1.0\n” (line ending: “\n”)

 “GET /shopping_list.txt HTTP/1.0\r\n” (line ending: “\r\n”)

– Request header lines

o RequestHeaderLine := FieldName + SP* + “:” + SP* + FieldValue + ENDL

o RequestHeaderLines := RequestHeaderLine*

o FieldName is case insensitive

o RequestHeaderLine Examples:

 VALID: “Connection: keep-alive\n”

 VALID: “connEctIoN:close\n” (space is optional; field name is case insensitive)

– EmptyLine := ENDL

– SP := “ ”

– ENDL := “\n” | “\r\n”

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com