Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(855)

Side by Side Diff: util/net/http_transport_test_server.py

Issue 854363006: win: Implementation of http_transport_win based on WinInet (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@multiproc-impl
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/net/http_transport_test.cc ('k') | util/net/http_transport_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 # Copyright 2014 The Crashpad Authors. All rights reserved. 4 # Copyright 2014 The Crashpad Authors. All rights reserved.
5 # 5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License. 7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at 8 # You may obtain a copy of the License at
9 # 9 #
10 # http://www.apache.org/licenses/LICENSE-2.0 10 # http://www.apache.org/licenses/LICENSE-2.0
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if chunk_size_end == -1: 111 if chunk_size_end == -1:
112 # No chunk extensions; just encounter the end of line. 112 # No chunk extensions; just encounter the end of line.
113 chunk_size_end = chunk_size_and_ext_line.find('\r') 113 chunk_size_end = chunk_size_and_ext_line.find('\r')
114 if chunk_size_end == -1: 114 if chunk_size_end == -1:
115 self.send_response(400) # Bad request. 115 self.send_response(400) # Bad request.
116 return -1 116 return -1
117 return int(chunk_size_and_ext_line[:chunk_size_end], base=16) 117 return int(chunk_size_and_ext_line[:chunk_size_end], base=16)
118 118
119 119
120 def Main(): 120 def Main():
121 if sys.platform == 'win32':
122 import os, msvcrt
123 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
124
121 # Start the server. 125 # Start the server.
122 server = BaseHTTPServer.HTTPServer(('127.0.0.1', 0), RequestHandler) 126 server = BaseHTTPServer.HTTPServer(('127.0.0.1', 0), RequestHandler)
123 127
124 # Write the port as an unsigned short to the parent process. 128 # Write the port as an unsigned short to the parent process.
125 sys.stdout.write(struct.pack('=H', server.server_address[1])) 129 sys.stdout.write(struct.pack('=H', server.server_address[1]))
126 sys.stdout.flush() 130 sys.stdout.flush()
127 131
128 # Read the desired test response code as an unsigned short from the parent 132 # Read the desired test response code as an unsigned short from the parent
129 # process. 133 # process.
130 RequestHandler.response_code = \ 134 RequestHandler.response_code = \
131 struct.unpack('=H', sys.stdin.read(struct.calcsize('=H')))[0] 135 struct.unpack('=H', sys.stdin.read(struct.calcsize('=H')))[0]
132 136
133 # Handle the request. 137 # Handle the request.
134 server.handle_request() 138 server.handle_request()
135 139
136 if __name__ == '__main__': 140 if __name__ == '__main__':
137 Main() 141 Main()
OLDNEW
« no previous file with comments | « util/net/http_transport_test.cc ('k') | util/net/http_transport_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698