httpstat - Ọpa Ẹrọ Iṣiro-ọrọ lati Ṣayẹwo Iṣe oju opo wẹẹbu


httpstat jẹ iwe afọwọkọ Python kan ti o tan imọlẹ awọn iṣiro curl ni ọna ti o fanimọra ati ti asọye daradara, o jẹ faili kan ṣoṣo eyiti o ni ibamu pẹlu Python 3 ati pe ko nilo afikun software (awọn igbẹkẹle) lati fi sori ẹrọ lori eto awọn olumulo.

O jẹ ipilẹ ohun elo ti ohun elo cURL, tumọ si pe o le lo ọpọlọpọ awọn aṣayan cURL to wulo lẹhin URL (s) kan, laisi awọn aṣayan -w, -D, -o, -s, ati -S, eyiti o ti ṣiṣẹ tẹlẹ nipasẹ httpstat .

O le wo ninu aworan ti o wa loke tabili ASCII kan ti o nfihan bi gigun ilana kọọkan ti gba, ati fun mi igbesẹ pataki julọ ni “ṣiṣe olupin” - ti nọmba yii ba ga julọ, lẹhinna o nilo lati tune olupin rẹ lati yara si oju opo wẹẹbu.

Fun oju opo wẹẹbu tabi yiyi olupin ṣe o le ṣayẹwo awọn nkan wa nibi:

  1. Awọn imọran 5 lati Ṣiṣẹ Iṣẹ ti Apakan Wẹẹbu Apache
  2. Ṣiṣe Afun Titẹ ati Iṣe Nginx Upto 10x
  3. Bii o ṣe le ṣe alekun Iṣẹ Nginx Lilo Module Gzip
  4. Awọn imọran 15 lati Tune Iṣẹ MySQL/MariaDB

Ja gba httpstat lati ṣayẹwo iyara oju opo wẹẹbu rẹ nipa lilo awọn itọnisọna fifi sori ẹrọ ati lilo.

Fi sori ẹrọ httpstat ni Awọn ọna Linux

O le fi ohun elo httpstat sii nipa lilo awọn ọna ti o ṣee ṣe meji:

1. Gba taara lati inu re Github repo nipa lilo aṣẹ wget gẹgẹbi atẹle:

$ wget -c https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py

2. Lilo pip (ọna yii gba laaye httpstat lati fi sori ẹrọ lori eto rẹ bi aṣẹ) bii bẹ:

$ sudo pip install httpstat

Akiyesi: Rii daju pe o ti fi paipu pip sori ẹrọ, ti ko ba fi sii nipa lilo oluṣakoṣo olupin pipin pinpin rẹ.

Bii o ṣe le Lo httpstat ni Lainos

O le ṣee lo httpstat ni ibamu si ọna ti o fi sii, ti o ba gba lati ayelujara taara, ṣiṣe ni lilo ilana atẹle lati inu itọsọna igbasilẹ:

$ python httpstat.py url cURL_options 

Ni ọran ti o lo pip lati fi sii, o le ṣe bi aṣẹ ni fọọmu ni isalẹ:

$ httpstat url cURL_options  

Lati wo oju-iwe iranlọwọ fun httpstat, gbekalẹ aṣẹ ni isalẹ:

$ python httpstat.py --help
OR
$ httpstat --help
Usage: httpstat URL [CURL_OPTIONS]
       httpstat -h | --help
       httpstat --version

Arguments:
  URL     url to request, could be with or without `http(s)://` prefix

Options:
  CURL_OPTIONS  any curl supported options, except for -w -D -o -S -s,
                which are already used internally.
  -h --help     show this screen.
  --version     show version.

Environments:
  HTTPSTAT_SHOW_BODY    Set to `true` to show response body in the output,
                        note that body length is limited to 1023 bytes, will be
                        truncated if exceeds. Default is `false`.
  HTTPSTAT_SHOW_IP      By default httpstat shows remote and local IP/port address.
                        Set to `false` to disable this feature. Default is `true`.
  HTTPSTAT_SHOW_SPEED   Set to `true` to show download and upload speed.
                        Default is `false`.
  HTTPSTAT_SAVE_BODY    By default httpstat stores body in a tmp file,
                        set to `false` to disable this feature. Default is `true`
  HTTPSTAT_CURL_BIN     Indicate the curl bin path to use. Default is `curl`
                        from current shell $PATH.
  HTTPSTAT_DEBUG        Set to `true` to see debugging logs. Default is `false`

Lati iṣejade aṣẹ iranlọwọ loke, o le rii pe httpstat ni ikojọpọ ti awọn oniyipada ayika to wulo ti o ni ipa ihuwasi rẹ.

Lati lo wọn, nirọrun gbe awọn oniyipada jade pẹlu iye ti o yẹ ninu .bashrc tabi .zshrc faili.

Fun apẹẹrẹ:

export  HTTPSTAT_SHOW_IP=false
export  HTTPSTAT_SHOW_SPEED=true
export  HTTPSTAT_SAVE_BODY=false
export  HTTPSTAT_DEBUG=true

Ni kete ti o ba ti ṣafikun wọn, ṣafipamọ faili naa ki o ṣiṣẹ aṣẹ ni isalẹ lati ṣe awọn ayipada naa:

$ source  ~/.bashrc

O tun le ṣọkasi ọna alakomeji cURL lati lo, aiyipada ni ọmọ-lati ikarahun lọwọlọwọ $PATH oniyipada ayika.

Ni isalẹ wa awọn apẹẹrẹ diẹ ti o fihan bi httpsat ṣe n ṣiṣẹ.

$ python httpstat.py google.com
OR
$ httpstat google.com

Ni aṣẹ atẹle:

    Flag pipaṣẹ n ṣalaye ọna ibeere aṣa lati lo lakoko sisọrọ pẹlu olupin HTTP
  1. -x asia aṣẹ
  2. --data-urlencode data posts data (a = b ninu ọran yii) pẹlu fifi koodu URL titan.
  3. -v n jẹ ki ipo ọrọ-ọrọ kan ṣiṣẹ.

$ python httpstat.py httpbin.org/post -X POST --data-urlencode "a=b" -v 

O le wo nipasẹ oju-iwe eniyan cURL fun iwulo diẹ sii ati awọn aṣayan ilọsiwaju tabi lọ si ibi ipamọ Github httpstat: https://github.com/reorx/httpstat

Ninu nkan yii, a ti bo ọpa ti o wulo fun mimojuto awọn iṣiro cURL jẹ ọna ti o rọrun ati fifin. Ti o ba mọ iru awọn irinṣẹ bẹẹ ni ita, ma ṣe ṣiyemeji lati jẹ ki a mọ ati pe o le beere ibeere daradara tabi ṣe asọye nipa nkan yii tabi httpstat nipasẹ apakan esi ni isalẹ.