The ``Content-Location`` header.
19871
def content_location(self) -> Optional[UnstructuredHeader]:
        """"""
        try:
            return cast(UnstructuredHeader, self[b'content-location'][0])
        except (KeyError, IndexError):
            return None
150552
def userContent(self):
        """"""
        replace_start = self._url.lower().find("/community/")
        len_replace = len("/community/")
        url = self._url.replace(self._url[replace_start:replace_start+len_replace],
                                '/content/')
        from ._content import User as UserContent
        return UserContent(url=url,
                           securityHandler=self._securityHandler,
                           proxy_url=self._proxy_url,
                           proxy_port=self._proxy_port)
1059978
def fix_location_tag(dom):
    
    location = dom.match(
        "mods:mods",
        "mods:location",
    )

    # if no location tag found, there is nothing to be fixed
    if not location:
        return
    location = first(location)

    # fix only <mods:location> containing <mods:physicalLocation> tags
    if not location.find("mods:physicalLocation"):
        return

    url = location.find("mods:url", {"usage": "primary display"})

    # parse URL
    if url:
        url = first(url).getContent()
    else:
        urls = filter(
            lambda x: x.getContent(),
            location.find("mods:url")
        )

        if not urls:
            return

        url_tag = max(urls, key=lambda x: len(x.getContent()))
        url = url_tag.getContent()

    # replace the code with new tag
    replacer = dhtmlparser.parseString("""
  <mods:location>
    <mods:holdingSimple>
      <mods:copyInformation>
        <mods:electronicLocator>""" + url + """</mods:electronicLocator>
      </mods:copyInformation>
    </mods:holdingSimple>
  </mods:location>
    """)

    location.replaceWith(
        first(replacer.find("mods:location"))
    )

    dhtmlparser.makeDoubleLinked(dom)
939198
def location(self):
        
        if self._location is None:
            self._location = "{}/{}-{}".format(
                self.stream,
                self.type,
                self.sequence,
            )
        return self._location
1154992
def pwd(editor, location):
    "  "
    try:
        os.chdir(location)
    except OSError as e:
        editor.show_message('{}'.format(e))
1004452
def expose_content(self):
        """"""
        placeholders = get_placeholders(self.get_template())
        exposed_content = []
        for lang in self.get_languages():
            for ctype in [p.name for p in placeholders]:
                content = self.get_content(lang, ctype, False)
                if content:
                    exposed_content.append(content)
        return u"\r\n".join(exposed_content)
594792
def content(self):
        """"""
        return _content.Content(url=self._url + "/content",
                                securityHandler=self._securityHandler,
                                proxy_url=self._proxy_url,
                                proxy_port=self._proxy_port)
725135
def _process_content_header(self, channel, payload):
        """"""
        partial = self.partial_messages[channel]
        partial.add_header(payload)

        if partial.complete:
            #
            # a bodyless message, we're done
            #
            self._quick_put((channel, partial.method_sig,
                             partial.args, partial.msg))
            self.partial_messages.pop(channel, None)
            self.expected_types[channel] = 1
        else:
            #
            # wait for the content-body
            #
            self.expected_types[channel] = 3
1060698
def retrieve_content(self):
        """"""
        path = self._construct_path_to_source_content()
        res = self._http.get(path)
        self._populated_fields['content'] = res['content']
        return res['content']
840514
function headers(buffer) {
    var head = {};
    if (buffer[0] === 0x89 && buffer[1] === 0x50 && buffer[2] === 0x4E &&
        buffer[3] === 0x47 && buffer[4] === 0x0D && buffer[5] === 0x0A &&
        buffer[6] === 0x1A && buffer[7] === 0x0A) {
        head['Content-Type'] = 'image/png';
    } else if (buffer[0] === 0xFF && buffer[1] === 0xD8 &&
        buffer[buffer.length - 2] === 0xFF && buffer[buffer.length - 1] === 0xD9) {
        head['Content-Type'] = 'image/jpeg';
    } else if (buffer[0] === 0x47 && buffer[1] === 0x49 && buffer[2] === 0x46 &&
        buffer[3] === 0x38 && (buffer[4] === 0x39 || buffer[4] === 0x37) &&
        buffer[5] === 0x61) {
        head['Content-Type'] = 'image/gif';
    } else if (buffer[0] === 0x52 && buffer[1] === 0x49 && buffer[2] === 0x46 && buffer[3] === 0x46 &&
        buffer[8] === 0x57 && buffer[9] === 0x45 && buffer[10] === 0x42 && buffer[11] === 0x50) {
        head['Content-Type'] = 'image/webp';
    // deflate: recklessly assumes contents are PBF.
    } else if (buffer[0] === 0x78 && buffer[1] === 0x9C) {
        head['Content-Type'] = 'application/x-protobuf';
        head['Content-Encoding'] = 'deflate';
    // gzip: recklessly assumes contents are PBF.
    } else if (buffer[0] === 0x1F && buffer[1] === 0x8B) {
        head['Content-Type'] = 'application/x-protobuf';
        head['Content-Encoding'] = 'gzip';
    }
    return head;
}
956163
def _headers(self, others={}):
        """"""
        headers = {
            'Content-Type': 'application/json'
        }

        for p in others.keys():
            headers[p] = others[p]
        return headers
940918
private function setHeader ()
    {
        ob_get_clean ();
        header ("Content-Type: video/mp4");
        header ("Cache-Control: max-age=2592000, public");
        header ("Expires: " . gmdate ('D, d M Y H:i:s', time () + 2592000) . ' GMT');
        header ("Last-Modified: " . gmdate ('D, d M Y H:i:s', @filemtime ($this->path)) . ' GMT');
        $this->start = 0;
        $this->size  = filesize ($this->path);
        $this->end   = $this->size - 1;
        header ("Accept-Ranges: 0-" . $this->end);

        if (isset($_SERVER['HTTP_RANGE'])) {

            $c_start = $this->start;
            $c_end   = $this->end;

            list(, $range) = explode ('=', $_SERVER['HTTP_RANGE'], 2);

            if (strpos ($range, ',') !== false) {
                header ('HTTP/1.1 416 Requested Range Not Satisfiable');
                header ("Content-Range: bytes $this->start-$this->end/$this->size");
                exit;
            }

            if ($range == '-') {
                $c_start = $this->size - substr ($range, 1);
            } else {
                $range   = explode ('-', $range);
                $c_start = $range[0];

                $c_end = (isset($range[1]) && is_numeric ($range[1])) ? $range[1] : $c_end;
            }

            $c_end = ($c_end > $this->end) ? $this->end : $c_end;

            if ($c_start > $c_end || $c_start > $this->size - 1 || $c_end >= $this->size) {
                header ('HTTP/1.1 416 Requested Range Not Satisfiable');
                header ("Content-Range: bytes $this->start-$this->end/$this->size");
                exit;
            }

            $this->start = $c_start;
            $this->end   = $c_end;
            $length      = $this->end - $this->start + 1;

            fseek ($this->stream, $this->start);
            header ('HTTP/1.1 206 Partial Content');
            header ("Content-Length: " . $length);
            header ("Content-Range: bytes $this->start-$this->end/" . $this->size);
        } else
            header ("Content-Length: " . $this->size);
    }
1087457
def to_header(self):
        """"""
        if self.star_tag:
            return "*"
        return ", ".join(
            ['"%s"' % x for x in self._strong] + ['W/"%s"' % x for x in self._weak]
        )
38140
def select_header_content_type(content_types)
      if content_types.empty?
        'application/json' # use application/json by default
      elsif content_types.any?{ |s| s.casecmp('application/json')==0 }
        'application/json' # use application/json if it's included
      else
        content_types[0] # otherwise, use the first one
      end
    end
227611
def body(self, data):
        """"""
        if data is not None:
            self._body = data
            self.add_header('Content-Length', str(len(self._body)))
631555
public void setContent(IContent content)
	{
		this.content = content;
		content.setParent(this);
		content.setPosition(Position.middleCenter(content).plus(offsetPosition));
	}
1213098
def move_content_to_origin(self):
        """"""
        tcs = list(self.iter_tcs())
        origin_tc = tcs[0]
        for spanned_tc in tcs[1:]:
            origin_tc.append_ps_from(spanned_tc)