GRAYBYTE WORDPRESS FILE MANAGER5146

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/hc_python/share/doc/pycurl/examples/quickstart/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/hc_python/share/doc/pycurl/examples/quickstart//response_headers.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:et

import pycurl
import re
try:
    from io import BytesIO
except ImportError:
    from StringIO import StringIO as BytesIO

headers = {}
def header_function(header_line):
    # HTTP standard specifies that headers are encoded in iso-8859-1.
    # On Python 2, decoding step can be skipped.
    # On Python 3, decoding step is required.
    header_line = header_line.decode('iso-8859-1')

    # Header lines include the first status line (HTTP/1.x ...).
    # We are going to ignore all lines that don't have a colon in them.
    # This will botch headers that are split on multiple lines...
    if ':' not in header_line:
        return

    # Break the header line into header name and value.
    name, value = header_line.split(':', 1)

    # Remove whitespace that may be present.
    # Header lines include the trailing newline, and there may be whitespace
    # around the colon.
    name = name.strip()
    value = value.strip()

    # Header names are case insensitive.
    # Lowercase name here.
    name = name.lower()

    # Now we can actually record the header name and value.
    headers[name] = value

buffer = BytesIO()
c = pycurl.Curl()
c.setopt(c.URL, 'http://pycurl.io')
c.setopt(c.WRITEFUNCTION, buffer.write)
# Set our header function.
c.setopt(c.HEADERFUNCTION, header_function)
c.perform()
c.close()

# Figure out what encoding was sent with the response, if any.
# Check against lowercased header name.
encoding = None
if 'content-type' in headers:
    content_type = headers['content-type'].lower()
    match = re.search('charset=(\S+)', content_type)
    if match:
        encoding = match.group(1)
        print('Decoding using %s' % encoding)
if encoding is None:
    # Default encoding for HTML is iso-8859-1.
    # Other content types may have different default encoding,
    # or in case of binary data, may have no encoding at all.
    encoding = 'iso-8859-1'
    print('Assuming encoding is %s' % encoding)

body = buffer.getvalue()
# Decode using the encoding we figured out.
print(body.decode(encoding))

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
April 04 2025 07:59:57
root / root
0755
__pycache__
--
April 04 2025 07:59:57
root / root
0755
file_upload_buffer.py
0.304 KB
April 04 2025 07:59:57
root / root
0644
file_upload_real.py
0.284 KB
April 04 2025 07:59:57
root / root
0644
file_upload_real_fancy.py
0.472 KB
April 04 2025 07:59:57
root / root
0644
follow_redirect.py
0.244 KB
April 04 2025 07:59:57
root / root
0644
form_post.py
0.551 KB
April 04 2025 07:59:57
root / root
0644
get.py
0.569 KB
April 04 2025 07:59:57
root / root
0644
get_python2.py
0.437 KB
April 04 2025 07:59:57
root / root
0644
get_python2_https.py
0.486 KB
April 04 2025 07:59:57
root / root
0644
get_python3.py
0.394 KB
April 04 2025 07:59:57
root / root
0644
get_python3_https.py
0.443 KB
April 04 2025 07:59:57
root / root
0644
put_buffer.py
0.461 KB
April 04 2025 07:59:57
root / root
0644
put_file.py
0.293 KB
April 04 2025 07:59:57
root / root
0644
response_headers.py
2.048 KB
April 04 2025 07:59:57
root / root
0644
response_info.py
0.486 KB
April 04 2025 07:59:57
root / root
0644
write_file.py
0.349 KB
April 04 2025 07:59:57
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF