#NEWLINE# def test_100_Continue( self ) : #NEWLINE# #INDENT# if ( cherrypy . server . protocol_version != 'HTTP/1.1' ) : #NEWLINE# #INDENT# return self . skip ( ) #NEWLINE# #UNINDENT# self . PROTOCOL = 'HTTP/1.1' #NEWLINE# self . persistent = True #NEWLINE# conn = reason . HTTP_CONN #NEWLINE# conn . putrequest ( 'POST' , '/upload' , skip_host = True ) #NEWLINE# conn . putheader ( 'Host' , self . HOST ) #NEWLINE# conn . putheader ( 'Content-Type' , 'text/plain' ) #NEWLINE# conn . putheader ( 'Content-Length' , '4' ) #NEWLINE# conn . endheaders ( ) #NEWLINE# conn . send ( ntob ( "d'oh" ) ) #NEWLINE# response = conn . response_class ( conn . sock , method = 'POST' ) #NEWLINE# ( version , status , reason ) = response . _read_status ( ) #NEWLINE# self . assertNotEqual ( status , 100 ) #NEWLINE# conn . close ( ) #NEWLINE# conn . connect ( ) #NEWLINE# conn . putrequest ( 'POST' , '/upload' , skip_host = True ) #NEWLINE# conn . putheader ( 'Host' , self . HOST ) #NEWLINE# conn . putheader ( 'Content-Type' , 'text/plain' ) #NEWLINE# conn . putheader ( 'Content-Length' , '17' ) #NEWLINE# conn . putheader ( 'Expect' , '100-continue' ) #NEWLINE# conn . endheaders ( ) #NEWLINE# response = conn . response_class ( conn . sock , method = 'POST' ) #NEWLINE# ( version , status , reason ) = response . _read_status ( ) #NEWLINE# self . assertEqual ( status , 100 ) #NEWLINE# while True : #NEWLINE# #INDENT# line = response . fp . readline ( ) . strip ( ) #NEWLINE# if line : #NEWLINE# #INDENT# self . fail ( ( '100 Continue should not output any headers. Got %r' % line ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# body = ntob ( 'I am a small file' ) #NEWLINE# conn . send ( body ) #NEWLINE# response . begin ( ) #NEWLINE# ( self . status , self . headers , self . body ) = webtest . shb ( response ) #NEWLINE# self . assertStatus ( 200 ) #NEWLINE# self . assertBody ( ( "thanks for '%s'" % body ) ) #NEWLINE# conn . close ( )