sThread
[ class tree: sThread ] [ index: sThread ] [ all elements ]

Class: sThread_HTTP

Source Location: /sThread/sThread/Modules/http.php

Class Overview


sThread HTTP module


Author(s):

Copyright:

  • (c) 2015 OOPS.ORG

Variables

Constants

Methods



Class Details

[line 68]
sThread HTTP module

HTTP protocol을 테스트 한다. (https는 지원하지 않는다.)

점검시에, 반환값이 200이 아닐경우 실패로 결과를 보내며, response header의 content-length와 실제 받은 데이터 사이즈가 동일해야 정상 처리로 판단을 한다.

chunked 전송의 경우 chuned된 데이터를 파싱을 해서 사이즈가 맞는지 비교를 한다.

HTTP 모듈에 사용할 수 있는 모듈 option은 다음과 같다.

  • uri: URI
  • host: HTTP/1.1 Host header 값
  • agent: User Agent 값
  • referer: Referer 값

예제:

  1.    sThread::execute ('domain.com:80:http|uri=>/robot.txt,host=>www.domaing.com'2'tcp');

* 경고! 4KB 이하의 문서에 사용하는 것을 권장한다. 만약 100K가 넘는 문서라면 event_buffer_read 크기를 40960 정도로 증가 하는 것이 좋다.




Tags:

author:  JoungKyun.Kim <http://oops.org>
copyright:  (c) 2015 OOPS.ORG
link:  http://pear.oops.org/package/sThread
license:  BSD


[ Top ]


Class Variables

static $clearsession =

[line 80]

이 변수의 값이 true로 셋팅이 되면, clear_session method를 만들어 줘야 한다. 반대로 false 상태에서는 clear_session method가 존재하지 않아도 상관이 없다.



Tags:

access:  public

Type:   bool


[ Top ]

static $port =

[line 90]

HTTP 모듈이 사용하는 기본 포트 번호



Tags:

access:  public

Type:   int


[ Top ]

static $protocol =

[line 85]

HTTP 모듈이 사용하는 protocol



Tags:

access:  public

Type:   string


[ Top ]



Class Methods


constructor __construct [line 115]

sThread_HTTP __construct( )

Class OOP 형식 초기화 메소드



Tags:

access:  public


[ Top ]

method call_status [line 186]

int|string call_status( int $status, [boolean $call = false])

현재의 status(integer) 또는 현재 status의 handler 이름을 반환한다.



Tags:

access:  public


Parameters:

int   $status   현재 status
boolean   $call   true로 설정했을 경우 현재 status의 handler 이름을 반환한다.

[ Top ]

method change_status [line 215]

void change_status( boolean &$sess, stdClass $key, int 2)

세션의 상태를 단계로 변경한다.



Tags:

access:  public


Parameters:

int   2   세션 키
boolean   &$sess   변경한 상태가 마지막 단계일 경우 false를 반환한다.
stdClass   $key   sThread 세션 변수 reference

[ Top ]

method check_buf_status [line 157]

int check_buf_status( int $status)

현재 상태가 event read 상태인지 event write 상태인지 를 판단한다.



Tags:

access:  public


Parameters:

int   $status   현재 status

[ Top ]

method clear_session [line 249]

void clear_session( int $key)

session에서 사용한 변수(self::$sess)의 값을 정리한다.

self::$clearsession == false 일 경우, clear_session method 는 존재하지 않아도 된다.




Tags:

access:  public


Parameters:

int   $key   세션 키

[ Top ]

method http_request [line 303]

void http_request( stdClass &$sess, int $key)

HTTP 요청 데이터를 반환



Tags:

access:  public


Parameters:

stdClass   &$sess   세션 object
int   $key   세션 키

[ Top ]

method http_response [line 339]

bool|null http_response( stdClass &$sess, int $key, mixed $recv)

서버의 응답을 확인



Tags:

return:  결과 값은 다음과 같다.
  • true: 모든 전송이 완료
  • false: 전송할 것이 남아 있음. readcallback에서 false를 받으면 status를 유지한다.
  • null: 전송 중 에러 발생
access:  public


Parameters:

stdClass   &$sess   세션 object
int   $key   세션 키
mixed   $recv   read callback에서 전송받은 누적 데이터

[ Top ]

method init [line 134]

void init( )

HTTP 모듈을 초기화 한다.



Tags:

access:  public


[ Top ]

method set_last_status [line 233]

void set_last_status( stdClass &$sess, int $key)

세션의 상태를 마지막 단계로 변경한다.



Tags:

access:  public


Parameters:

stdClass   &$sess   sThread 세션 변수 reference
int   $key   세션 키

[ Top ]


Class Constants

HTTP_CLOSE =  3

[line 94]



Tags:

access:  public

[ Top ]

HTTP_REQUEST =  1

[line 92]



Tags:

access:  public

[ Top ]

HTTP_RESPONSE =  2

[line 93]



Tags:

access:  public

[ Top ]



Documentation generated on Tue, 14 May 2019 02:00:05 +0900 by phpDocumentor 1.4.4