def _addHeaderToRequest(request, header):
 requestHeaders = request.requestHeaders
 (name, value) = header
 values = requestHeaders.getRawHeaders(name)
 if (values is not None):
  values.append(value)
 else:
  requestHeaders.setRawHeaders(name, [value])
 if (name == 'content-length'):
  request.gotLength(int(value))
  return True
 return False

def _addHeaderToRequest ( request , header ) : requestHeaders = request . requestHeaders ( name , value ) = header values = requestHeaders . getRawHeaders ( name ) if ( values is not None ) : values . append ( value ) else : requestHeaders . setRawHeaders ( name , [ value ] ) if ( name == 'content-length' ) : request . gotLength ( int ( value ) ) return True return False
add a header tuple to a request header object .