@@ -681,14 +681,6 @@ def save(self, opts): ####################################################
681681 except Exception as e :
682682 raise DirpyFatalError ("Can't save image to disk: %s" % e )
683683
684- # Seek to the end of the buffer so we can get our content
685- # size without allocating to a string (which we don't want
686- # to do if this is a HEAD request). Then seek back to the
687- # beginning so we can read the string later
688- self .out_buf .seek (0 ,os .SEEK_END )
689- self .out_size = self .out_buf .tell ()
690- self .out_buf .seek (0 )
691-
692684 # If the user has requested "noshow", we don't want to return the
693685 # image back to them (presumably because we have saved it to disk
694686 # and that is all they care about, so we don't have to waste
@@ -697,6 +689,14 @@ def save(self, opts): ####################################################
697689 logger .debug ("Not showing %s, as requested" % self .file_path )
698690 self .out_buf = io .BytesIO ()
699691
692+ # Seek to the end of the buffer so we can get our content
693+ # size without allocating to a string (which we don't want
694+ # to do if this is a HEAD request). Then seek back to the
695+ # beginning so we can read the string later
696+ self .out_buf .seek (0 ,os .SEEK_END )
697+ self .out_size = self .out_buf .tell ()
698+ self .out_buf .seek (0 )
699+
700700 # Put together some image metadata in JSON format
701701 self .meta_data ["g" ]["out_width" ] = self .out_x
702702 self .meta_data ["g" ]["out_height" ] = self .out_y
@@ -1009,11 +1009,13 @@ def http_worker(req, method="GET"): ##########################################
10091009 if result .http_code == 204 :
10101010 req .send_response (204 )
10111011 req .send_header ("Dirpy-Data" , result .yield_meta_data ())
1012+ req .end_headers ()
10121013 return
10131014 # Throw an error if required
10141015 elif result .http_msg is not None :
10151016 req .send_error (result .http_code , result .http_msg )
10161017 req .send_header ("Dirpy-Data" , result .yield_meta_data ())
1018+ req .end_headers ()
10171019 return
10181020
10191021 # Now fire off a response to our client
0 commit comments