Browse Source

Log real request method

Pierre-Olivier Latour 11 years ago
parent
commit
6f90a3e6ce
1 changed files with 4 additions and 3 deletions
  1. 4 3
      CGDWebServer/GCDWebServerConnection.m

+ 4 - 3
CGDWebServer/GCDWebServerConnection.m

@@ -678,7 +678,7 @@ static NSString* _StringFromAddressData(NSData* data) {
 }
 
 - (GCDWebServerResponse*)processRequest:(GCDWebServerRequest*)request withBlock:(GCDWebServerProcessBlock)block {
-  LOG_DEBUG(@"Connection on socket %i processing %@ request for \"%@\" (%lu bytes body)", _socket, _request.method, _request.path, (unsigned long)_bytesRead);
+  LOG_DEBUG(@"Connection on socket %i processing request \"%@ %@\" with %lu bytes body", _socket, _virtualHEAD ? @"HEAD" : _request.method, _request.path, (unsigned long)_bytesRead);
   GCDWebServerResponse* response = nil;
   @try {
     response = block(request);
@@ -731,9 +731,10 @@ static inline BOOL _CompareResources(NSString* responseETag, NSString* requestET
   int result = close(_socket);
   if (result != 0) {
     LOG_ERROR(@"Failed closing socket %i for connection (%i): %s", _socket, errno, strerror(errno));
+  } else {
+    LOG_DEBUG(@"Did close connection on socket %i", _socket);
   }
-  LOG_DEBUG(@"Did close connection on socket %i", _socket);
-  LOG_VERBOSE(@"[%@] %@ %i \"%@ %@\" (%lu | %lu)", self.localAddressString, self.remoteAddressString, (int)_statusCode, _request.method, _request.path, (unsigned long)_bytesRead, (unsigned long)_bytesWritten);
+  LOG_VERBOSE(@"[%@] %@ %i \"%@ %@\" (%lu | %lu)", self.localAddressString, self.remoteAddressString, (int)_statusCode, _virtualHEAD ? @"HEAD" : _request.method, _request.path, (unsigned long)_bytesRead, (unsigned long)_bytesWritten);
 }
 
 @end