Adds the authentication header.
351531
protected void initAuthenticationHeader() {
        if (isAuthenticated()) {
            // Calculate the v2 signature
            // http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html
            // #ConstructingTheAuthenticationHeader

            // Date should look like Thu, 17 Nov 2005 18:49:58 GMT, and must be
            // within 15 min. of S3 server time. contentMd5 and type are optional

            // We can't risk letting our date get clobbered and being inconsistent
            final String xamzdate = new SimpleDateFormat(DATE_FORMAT, Locale.US).format(new Date());
            final StringJoiner signedHeaders = new StringJoiner(EOL, "", EOL);
            final StringBuilder toSign = new StringBuilder();
            final String key = myKey.charAt(0) == '?' ? "" : myKey;

            headers().add("X-Amz-Date", xamzdate);
            signedHeaders.add("x-amz-date:" + xamzdate);

            if (!StringUtils.isEmpty(mySessionToken)) {
                headers().add("X-Amz-Security-Token", mySessionToken);
                signedHeaders.add("x-amz-security-token:" + mySessionToken);
            }

            toSign.append(myMethod).append(EOL).append(myContentMd5).append(EOL).append(myContentType).append(EOL)
                    .append(EOL).append(signedHeaders).append(PATH_SEP).append(myBucket).append(PATH_SEP).append(key);

            try {
                final String signature = b64SignHmacSha1(mySecretKey, toSign.toString());
                final String authorization = "AWS" + " " + myAccessKey + ":" + signature;

                headers().add("Authorization", authorization);
            } catch (InvalidKeyException | NoSuchAlgorithmException details) {
                LOGGER.error("Failed to sign S3 request due to {}", details);
            }
        }
    }
114905
protected function addHeaders()
    {
        $userHeaders = array_map(function ($key, $value) {
            // format header like this 'x-header: value'
            return sprintf('%s: %s', $key, $value);
        }, array_keys($this->payload['headers']), $this->payload['headers']);

        $headers = array_merge($this->defaultHeaders, $userHeaders);

        $this->addCurlOption(CURLOPT_HTTPHEADER, $headers);
    }
821695
public void addHeader(String key, Object value) {
		List<Object> values = headers.get(key);
		if (values == null) {
			headers.put(key, values = new ArrayList<Object>());
		}
		values.add(value);
	}
926147
def AddHeader(self, header, value):
        '''
        '''
        self.user_headers.append((header, value))
        return self
1246698
def add_header(self, name, value):
        
        self._headers.setdefault(_hkey(name), []).append(_hval(value))
74422
private function _addHeaderRequirements()
    {
        $this->_headerRequirements = array();
        foreach ($this->getRequirements() as $key => $value) {
            if (0 === strpos($key, 'HTTP-')) {
                $this->_headerRequirements[substr($key, 5)] = $value;
            }
        }

        return $this;
    }
960403
public static void addAuthorizationHeader(URLConnection urlConnection, String header) {
        if (header != null) {
            urlConnection.setRequestProperty(AUTHORIZATION_HEADER, header);
        }
    }
158331
protected void addRequestHeaders(HessianConnection conn)
    {
        conn.addHeader("Content-Type", "x-application/hessian");
        conn.addHeader("Accept-Encoding", "deflate");

        String basicAuth = _factory.getBasicAuth();

        if (basicAuth != null)
            conn.addHeader("Authorization", basicAuth);
    }
989137
def make_auth_headers(self, content_type):
        """"""
        headers = self.make_headers(content_type)
        headers['Authorization'] = 'Basic {}'.format(self.get_auth_string())
        return headers
711505
public void addHeaderOutImpl(String key, String value)
  {
    if (headerOutSpecial(key, value)) {
      return;
    }
    
    ArrayList<String> keys = _headerKeysOut;
    ArrayList<String> values = _headerValuesOut;
    
    int size = keys.size();
    
    // webapp/1k32
    for (int i = 0; i < size; i++) {
      if (keys.get(i).equals(key) && values.get(i).equals(value)) {
        return;
      }
    }

    keys.add(key);
    values.add(value);
  }
702491
def add_header(self, header):
        """"""
        if type(header) is dict:
            self._headers.update(header)
        else:
            raise ValueError(
                "Dictionary expected, got '%s' instead" % type(header)
            )
335161
def _add_bearer_token(self, uri, http_method='GET', body=None,
                          headers=None, token_placement=None):
        """"""
        if token_placement == AUTH_HEADER:
            headers = tokens.prepare_bearer_headers(self.access_token, headers)

        elif token_placement == URI_QUERY:
            uri = tokens.prepare_bearer_uri(self.access_token, uri)

        elif token_placement == BODY:
            body = tokens.prepare_bearer_body(self.access_token, body)

        else:
            raise ValueError("Invalid token placement.")
        return uri, headers, body
881335
public function addHeader()
    {
        if (ord($this->BUF[0]{10}) & 0x80) {
            $cmap = 3 * (2 << (ord($this->BUF[0]{10}) & 0x07));
            $this->GIF .= substr($this->BUF[0], 6, 7);
            $this->GIF .= substr($this->BUF[0], 13, $cmap);
            $this->GIF .= "!\377\13NETSCAPE2.0\3\1" . $this->word($this->LOP) . "\0";
        }
    }
282322
@VisibleForTesting
  void setAuthenticationHeaders(Object soapClient, Map<String, Object> headerElements,
      AdWordsSession adWordsSession) throws AuthenticationException {
    authorizationHeaderHandler.setAuthorization(soapClient, adWordsSession);
  }
1186051
public void addHeader(String name, String value) {
	headers = ReqRspUtil.add(headers, name, value);
    }
876527
public HttpAuthServiceBuilder addBasicAuth(Authorizer<? super BasicToken> authorizer, AsciiString header) {
        return addTokenAuthorizer(new BasicTokenExtractor(requireNonNull(header, "header")),
                                  requireNonNull(authorizer, "authorizer"));
    }
651036
static void addHeaders(HttpUriRequest httpRequest, HttpHeaders headers) {
		for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
			String headerName = entry.getKey();
			if (HttpHeaders.COOKIE.equalsIgnoreCase(headerName)) {  // RFC 6265
				String headerValue = StringUtils.collectionToDelimitedString(entry.getValue(), "; ");
				httpRequest.addHeader(headerName, headerValue);
			}
			else if (!HTTP.CONTENT_LEN.equalsIgnoreCase(headerName) &&
					!HTTP.TRANSFER_ENCODING.equalsIgnoreCase(headerName)) {
				for (String headerValue : entry.getValue()) {
					httpRequest.addHeader(headerName, headerValue);
				}
			}
		}
	}