posted @ 2007-07-20 12:02 小螞蟻 閱讀(183) | 評論 (3) | 編輯 收藏

接了兩個USB攝像頭后,用了延長線的工作不正常,估計是USB的供電問題,回頭換根好點的試試看。
posted @ 2007-07-13 08:53 小螞蟻 閱讀(128) | 評論 (0) | 編輯 收藏
posted @ 2007-07-10 23:44 小螞蟻 閱讀(147) | 評論 (0) | 編輯 收藏
posted @ 2007-06-16 14:30 小螞蟻 閱讀(173) | 評論 (0) | 編輯 收藏
研究htdigest有一段時間了,在網上能找到的資料對具體的算法描述都很模糊,硬著頭皮看RFC 2671對算法大概有了認識,然后參考shttpd的源代碼終于搞清楚了,其實也很簡單:
response=MD5(ha1:nonce:nc:cnone:qop:a2)
其中:
ha1=MD5(username:realm:password)
a2=MD5(method:uri)
學習源碼是硬道理,網上寫這些東西的人不是相互對抄就是對RFC 2671簡單的翻譯,要不然就是我太笨了,郁悶...
sniffer備注:
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: obol.kmip.net
Connection: Keep-Alive
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="My Site",
nonce="3266a84c73f7e0e13f4fa6ba1d52d4ce",
qop="auth"
Content-Type: text/html
Content-Length: 351
Date: Sun, 10 Jun 2007 23:52:57 GMT
Server: lighttpd/1.4.13
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"<html xmlns=" <head>
<title>401 - Unauthorized</title>
</head>
<body>
<h1>401 - Unauthorized</h1>
</body>
</html>
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: obol.kmip.net
Connection: Keep-Alive
Authorization: Digest username="test",
realm="My Site",
qop="auth",
algorithm="MD5",
uri="/",
nonce="3266a84c73f7e0e13f4fa6ba1d52d4ce",
nc=00000001,
cnonce="5886b782b452993f7559cbd83b6b611b",
response="932dd7f51f34d766997923876508e620"
HTTP/1.1 200 OK
Content-Type: text/html
ETag: "972667827"
Accept-Ranges: bytes
Last-Modified: Sun, 22 Apr 2007 05:10:52 GMT
Content-Length: 2878
Date: Sun, 10 Jun 2007 23:56:44 GMT
Server: lighttpd/1.4.13
posted @ 2007-06-11 10:40 小螞蟻 閱讀(214) | 評論 (1) | 編輯 收藏
posted @ 2007-06-10 20:59 小螞蟻 閱讀(183) | 評論 (0) | 編輯 收藏
posted @ 2007-04-13 22:59 小螞蟻 閱讀(188) | 評論 (1) | 編輯 收藏
python升級到2.4.4后發現所有牽涉到socket的模塊都無法使用,上網找相關資料,發現居然連作者也不知道原因,沒辦法從package-6.1-release里裝回python-2.4.2,但py24-bsddb3無法使用,只能用py24-bsddb-2.4.2_2,被這奇怪的問題折騰到半夜3點,原來想倒騰berkeley db的興趣被弄得一點也沒了。
posted @ 2007-04-13 12:02 小螞蟻 閱讀(214) | 評論 (0) | 編輯 收藏
用spca5xx做的Livecam通過CGI在lighttpd下實現總有個問題:client網速慢的時候lighttpd的內存用量會不斷增加,一直到把系統榨干,沒辦法硬著頭皮看lighttpd的mod_cgi源碼,通過分析發現:
while(1) {
int n;
buffer_prepare_copy(hctx->response, 1024);
if (-1 == (n = read(hctx->fd, hctx->response->ptr, hctx->response->size - 1))) {
if (errno == EAGAIN || errno == EINTR) {
/* would block, wait for signal */
return FDEVENT_HANDLED_NOT_FINISHED;
}
......
} else {
http_chunk_append_mem(srv, con, hctx->response->ptr, hctx->response->used);
joblist_append(srv, con);
}
mod_cgi通過hctx->fd從cgi讀取數據,然后由http_chunk_append_men()提交到后臺,但chunk_append卻沒有限制內存的使用,當從cgi讀取的速度快過提交給client速度時內存用量就會不斷增加。本來想通過signal來同步cgi的采樣,但這樣太麻煩而且會破壞mod_cgi的結構,試著在read(hctx->fd...前加個阻塞判斷:
if (http_chunkqueue_length(server *srv, connection *con) > 102400) {
return FDEVENT_HANDLED_NOT_FINISHED;
}
if (-1==(n=read(hctx->fd...
然后在spca5shot里每采樣一frame加個sleep(1),運行幾天看效果再說
posted @ 2007-04-04 12:09 小螞蟻 閱讀(804) | 評論 (0) | 編輯 收藏