Doctrinal purity
This commit is contained in:
parent
d630a09247
commit
0003b737bd
|
@ -76,7 +76,7 @@
|
||||||
[range-delimiter-regexp #px#","]
|
[range-delimiter-regexp #px#","]
|
||||||
[range-regexp #px#"^([0-9]*)-([0-9]*)$"]
|
[range-regexp #px#"^([0-9]*)-([0-9]*)$"]
|
||||||
[range-error (lambda (header)
|
[range-error (lambda (header)
|
||||||
(display (format "Bad Range header: ~s. File a Racket bug report!\n"
|
(display (format "Bad Range header: ~s. File a Racket problem report!\n"
|
||||||
(header-value header))
|
(header-value header))
|
||||||
(current-error-port))
|
(current-error-port))
|
||||||
#f)])
|
#f)])
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
|
|
||||||
;; msie-from-local-machine? : table str str -> bool
|
;; msie-from-local-machine? : table str str -> bool
|
||||||
|
|
||||||
;; to work around a bug in MSIE for documents < 265 bytes when
|
;; to work around an error in MSIE for documents < 265 bytes when
|
||||||
;; connecting from the local machine. The server could pad the
|
;; connecting from the local machine. The server could pad the
|
||||||
;; response as MSIIS does, but closing the connection works, too. We
|
;; response as MSIIS does, but closing the connection works, too. We
|
||||||
;; do not check for version numbers since IE 6 under windows is 5.2
|
;; do not check for version numbers since IE 6 under windows is 5.2
|
||||||
|
|
|
@ -105,9 +105,9 @@ Here is an example typical of what you will find in many applications:
|
||||||
|
|
||||||
@defmodule[web-server/http/bindings]{
|
@defmodule[web-server/http/bindings]{
|
||||||
|
|
||||||
These functions, while convenient, could introduce subtle bugs into your
|
These functions, while convenient, could introduce subtle errors into your
|
||||||
application. Examples: that they are case-insensitive could introduce
|
application. Examples: that they are case-insensitive could introduce
|
||||||
a bug; if the data submitted is not in UTF-8 format, then the conversion
|
an error; if the data submitted is not in UTF-8 format, then the conversion
|
||||||
to a string will fail; if an attacker submits a form field as if it were
|
to a string will fail; if an attacker submits a form field as if it were
|
||||||
a file, when it is not, then the @racket[request-bindings] will hold a
|
a file, when it is not, then the @racket[request-bindings] will hold a
|
||||||
@racket[bytes?] object and your program will error; and, for file uploads
|
@racket[bytes?] object and your program will error; and, for file uploads
|
||||||
|
|
|
@ -699,7 +699,7 @@ Improve the presentation of the blog web application by writing
|
||||||
an external style sheet that suits your tastes. Adjust all of the HTML
|
an external style sheet that suits your tastes. Adjust all of the HTML
|
||||||
response handlers to include a link to the style sheet.
|
response handlers to include a link to the style sheet.
|
||||||
|
|
||||||
@section{The Double Submit Bug}
|
@section{The Double Submit Error}
|
||||||
@declare-exporting[#:use-sources (web-server/scribblings/tutorial/examples/iteration-7
|
@declare-exporting[#:use-sources (web-server/scribblings/tutorial/examples/iteration-7
|
||||||
web-server/servlet)]
|
web-server/servlet)]
|
||||||
|
|
||||||
|
@ -735,12 +735,12 @@ below?
|
||||||
|
|
||||||
@external-file["use-redirect.rkt"]
|
@external-file["use-redirect.rkt"]
|
||||||
|
|
||||||
So the double-submit bug is easy to prevent: whenever you have
|
So the double-submit error is easy to prevent: whenever you have
|
||||||
handlers that mutate the state of the system, use @racket[redirect/get] when
|
handlers that mutate the state of the system, use @racket[redirect/get] when
|
||||||
sending back your response.
|
sending back your response.
|
||||||
|
|
||||||
@bold{Exercise.}
|
@bold{Exercise.}
|
||||||
Use @racket[redirect/get] to fix the double-submit bug in the blog
|
Use @racket[redirect/get] to fix the double-submit error in the blog
|
||||||
application.
|
application.
|
||||||
|
|
||||||
With these minor fixes, our blog application now looks like this:
|
With these minor fixes, our blog application now looks like this:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user