首页 > 代码库 > squid的处理request和reply的流程

squid的处理request和reply的流程

request处理:

Breakpoint 6, SQUID_MD5Final (    digest=0x764d00 "\021dZcaFe\270\273a\020,\304j\222\347\227\372\364\206%B\245#\203\352\275It\357\266\343\003I\322`\225\250\370\204<k?I\275\353O9", ctx=0x7fff24ec0e80) at md5.c:131131    {(gdb) bt#0  SQUID_MD5Final (    digest=0x764d00 "\021dZcaFe\270\273a\020,\304j\222\347\227\372\364\206%B\245#\203\352\275It\357\266\343\003I\322`\225\250\370\204<k?I\275\353O9", ctx=0x7fff24ec0e80) at md5.c:131#1  0x0000000000489e35 in storeKeyPublicByRequestMethod (request=0x1d544a0, method=1) at store_key_md5.c:158#2  0x00000000004809c7 in storeGetPublicByRequestMethod (req=0x1d544a0, method=1) at store.c:371#3  0x00000000004809f1 in storeGetPublicByRequest (req=0x1d544a0) at store.c:377#4  0x0000000000428c1b in clientProcessRequest2 (http=0x1d54058) at client_side.c:3387#5  0x00000000004293aa in clientProcessRequest (http=0x1d54058) at client_side.c:3538#6  0x000000000042026b in clientCheckNoCacheDone (answer=1, data=http://www.mamicode.com/0x1d54058) at client_side.c:595#7  0x000000000040af87 in aclCheckCallback (checklist=0x1d66718, answer=ACCESS_ALLOWED) at acl.c:2297#8  0x000000000040ad7e in aclCheck (checklist=0x1d66718) at acl.c:2254#9  0x000000000040b3db in aclNBCheck (checklist=0x1d66718, callback=0x420211 <clientCheckNoCacheDone>,     callback_data=0x1d54058) at acl.c:2450#10 0x00000000004201e7 in clientCheckNoCache (http=0x1d54058) at client_side.c:583#11 0x000000000041f8dd in clientAccessCheck2 (data=http://www.mamicode.com/0x1d54058) at client_side.c:395#12 0x000000000041fa65 in clientFinishRewriteStuff (http=0x1d54058) at client_side.c:447#13 0x000000000042f2ac in clientStoreURLRewriteDone (data=http://www.mamicode.com/0x1d54058, result=0x0) at client_side_storeurl_rewrite.c:216#14 0x000000000042f0ef in clientStoreURLRewriteStart (http=0x1d54058) at client_side_storeurl_rewrite.c:178#15 0x000000000042ec44 in clientRedirectDone (data=http://www.mamicode.com/0x1d54058, result=0x0) at client_side_rewrite.c:482#16 0x000000000042e45a in clientRedirectAccessCheckDone (answer=0, data=http://www.mamicode.com/0x1d54058) at client_side_rewrite.c:361#17 0x000000000040af87 in aclCheckCallback (checklist=0x1d54b98, answer=ACCESS_DENIED) at acl.c:2297#18 0x000000000040ae1e in aclCheck (checklist=0x1d54b98) at acl.c:2266#19 0x000000000040b3db in aclNBCheck (checklist=0x1d54b98, callback=0x42e246 <clientRedirectAccessCheckDone>, ---Type <return> to continue, or q <return> to quit---    callback_data=0x1d54058) at acl.c:2450#20 0x000000000042e51f in clientRedirectStart (http=0x1d54058) at client_side_rewrite.c:374#21 0x000000000041fbe5 in clientAccessCheckDone (answer=1, data=http://www.mamicode.com/0x1d54058) at client_side.c:470#22 0x000000000040af87 in aclCheckCallback (checklist=0x1d54a18, answer=ACCESS_ALLOWED) at acl.c:2297#23 0x000000000040ad7e in aclCheck (checklist=0x1d54a18) at acl.c:2254#24 0x000000000040b3db in aclNBCheck (checklist=0x1d54a18, callback=0x41fa67 <clientAccessCheckDone>,     callback_data=0x1d54058) at acl.c:2450#25 0x000000000041f862 in clientAccessCheck (data=http://www.mamicode.com/0x1d54058) at client_side.c:384#26 0x000000000041f80f in clientCheckFollowXForwardedFor (data=http://www.mamicode.com/0x1d54058) at client_side.c:376#27 0x000000000042b7aa in clientTryParseRequest (conn=0x1d52d98) at client_side.c:4103#28 0x000000000042bd75 in clientReadRequest (fd=12, data=http://www.mamicode.com/0x1d52d98) at client_side.c:4221#29 0x0000000000432bd9 in comm_call_handlers (fd=12, read_event=1, write_event=0) at comm_generic.c:264#30 0x00000000004334de in do_comm_select (msec=735) at comm_epoll.c:195#31 0x0000000000432fc3 in comm_select (msec=735) at comm_generic.c:390#32 0x0000000000466c9a in main (argc=2, argv=0x7fff24ec1fd8) at main.c:863

 

 

(gdb) bt#0  SQUID_MD5Final (digest=0x764d20 "", ctx=0x7fff811cd960) at md5.c:131#1  0x0000000000489c02 in storeKeyPrivate (url=0x1cad320 "http://127.0.0.1:70/hello", method=1, id=1)    at store_key_md5.c:106#2  0x0000000000480b00 in storeSetPrivateKey (e=0x1cad3e0) at store.c:407#3  0x000000000048340c in storeCreateEntry (url=0x1cad290 "http://127.0.0.1:70/hello", flags=..., method=1)    at store.c:1097#4  0x0000000000420b06 in clientProcessExpired (http=0x1c830f8) at client_side.c:751#5  0x000000000042085b in clientRefreshCheckDone (data=http://www.mamicode.com/0x1c830f8, fresh=0, log=0x0) at client_side.c:707#6  0x00000000004765e7 in refreshCheckSubmit (entry=0x1c81d80, callback=0x4207d0 <clientRefreshCheckDone>,     callback_data=0x1c830f8) at refresh_check.c:451#7  0x00000000004207ce in clientRefreshCheck (http=0x1c830f8) at client_side.c:693#8  0x00000000004262a9 in clientCacheHit (data=http://www.mamicode.com/0x1c830f8, rep=0x1cabb10) at client_side.c:2453#9  0x000000000041f6b0 in storeClientCopyHeadersCB (data=http://www.mamicode.com/0x1c830f8, buf=0x1c9e1b0 "", size=272) at client_side.c:185#10 0x0000000000486af5 in storeClientCallback (sc=0x1c9e138, sz=272) at store_client.c:146#11 0x0000000000487bd2 in storeClientReadHeader (data=http://www.mamicode.com/0x1c9e138, buf=0x1c9e1b0 "", len=391) at store_client.c:512#12 0x000000000049c10c in storeUfsReadDone (fd=<value optimized out>, buf=0x1c9e1b0 "", len=<value optimized out>,     errflag=0, my_data=http://www.mamicode.com/0x1c81308) at ufs/store_io_ufs.c:238#13 0x0000000000434dec in diskHandleRead (fd=16, data=http://www.mamicode.com/0x1c81380) at disk.c:380#14 0x0000000000434ec8 in file_read (fd=16, buf=0x1c9e1b0 "", req_len=4096, file_offset=0,     handler=0x49c050 <storeUfsReadDone>, client_data=http://www.mamicode.com/0x1c81308) at disk.c:404#15 0x00000000004865c4 in storeRead (sio=0x1c81308, buf=0x1c9e1b0 "", size=4096, offset=0,     callback=0x48747a <storeClientReadHeader>, callback_data=http://www.mamicode.com/0x1c9e138) at store_io.c:103#16 0x00000000004872c6 in storeClientFileRead (sc=0x1c9e138) at store_client.c:338---Type <return> to continue, or q <return> to quit--- #17 0x0000000000487202 in storeClientCopy3 (e=0x1c81d80, sc=0x1c9e138) at store_client.c:327#18 0x0000000000486eab in storeClientCopy2 (e=0x1c81d80, sc=0x1c9e138) at store_client.c:249#19 0x0000000000486ce2 in storeClientCopy (sc=0x1c9e138, e=0x1c81d80, seen_offset=0, copy_offset=0, size=4096,     buf=0x1c9e1b0 "", callback=0x41f5c4 <storeClientCopyHeadersCB>, data=http://www.mamicode.com/0x1c830f8) at store_client.c:198#20 0x000000000041f73c in storeClientCopyHeaders (sc=0x1c9e138, e=0x1c81d80, callback=0x425520 <clientCacheHit>,     callback_data=0x1c830f8) at client_side.c:193#21 0x000000000042953b in clientProcessRequest (http=0x1c830f8) at client_side.c:3556#22 0x000000000042026b in clientCheckNoCacheDone (answer=1, data=http://www.mamicode.com/0x1c830f8) at client_side.c:595#23 0x000000000040af87 in aclCheckCallback (checklist=0x1c95998, answer=ACCESS_ALLOWED) at acl.c:2297#24 0x000000000040ad7e in aclCheck (checklist=0x1c95998) at acl.c:2254#25 0x000000000040b3db in aclNBCheck (checklist=0x1c95998, callback=0x420211 <clientCheckNoCacheDone>,     callback_data=0x1c830f8) at acl.c:2450#26 0x00000000004201e7 in clientCheckNoCache (http=0x1c830f8) at client_side.c:583#27 0x000000000041f8dd in clientAccessCheck2 (data=http://www.mamicode.com/0x1c830f8) at client_side.c:395#28 0x000000000041fa65 in clientFinishRewriteStuff (http=0x1c830f8) at client_side.c:447#29 0x000000000042f2ac in clientStoreURLRewriteDone (data=http://www.mamicode.com/0x1c830f8, result=0x0) at client_side_storeurl_rewrite.c:216#30 0x000000000042f0ef in clientStoreURLRewriteStart (http=0x1c830f8) at client_side_storeurl_rewrite.c:178#31 0x000000000042ec44 in clientRedirectDone (data=http://www.mamicode.com/0x1c830f8, result=0x0) at client_side_rewrite.c:482#32 0x000000000042e45a in clientRedirectAccessCheckDone (answer=0, data=http://www.mamicode.com/0x1c830f8) at client_side_rewrite.c:361#33 0x000000000040af87 in aclCheckCallback (checklist=0x1c83d58, answer=ACCESS_DENIED) at acl.c:2297#34 0x000000000040ae1e in aclCheck (checklist=0x1c83d58) at acl.c:2266#35 0x000000000040b3db in aclNBCheck (checklist=0x1c83d58, callback=0x42e246 <clientRedirectAccessCheckDone>,     callback_data=0x1c830f8) at acl.c:2450---Type <return> to continue, or q <return> to quit---#36 0x000000000042e51f in clientRedirectStart (http=0x1c830f8) at client_side_rewrite.c:374#37 0x000000000041fbe5 in clientAccessCheckDone (answer=1, data=http://www.mamicode.com/0x1c830f8) at client_side.c:470#38 0x000000000040af87 in aclCheckCallback (checklist=0x1c83ba8, answer=ACCESS_ALLOWED) at acl.c:2297#39 0x000000000040ad7e in aclCheck (checklist=0x1c83ba8) at acl.c:2254#40 0x000000000040b3db in aclNBCheck (checklist=0x1c83ba8, callback=0x41fa67 <clientAccessCheckDone>,     callback_data=0x1c830f8) at acl.c:2450#41 0x000000000041f862 in clientAccessCheck (data=http://www.mamicode.com/0x1c830f8) at client_side.c:384#42 0x000000000041f80f in clientCheckFollowXForwardedFor (data=http://www.mamicode.com/0x1c830f8) at client_side.c:376#43 0x000000000042b7aa in clientTryParseRequest (conn=0x1c81e38) at client_side.c:4103#44 0x000000000042bd75 in clientReadRequest (fd=12, data=http://www.mamicode.com/0x1c81e38) at client_side.c:4221#45 0x0000000000432bd9 in comm_call_handlers (fd=12, read_event=1, write_event=0) at comm_generic.c:264#46 0x00000000004334de in do_comm_select (msec=998) at comm_epoll.c:195#47 0x0000000000432fc3 in comm_select (msec=998) at comm_generic.c:390#48 0x0000000000466c9a in main (argc=2, argv=0x7fff811cf088) at main.c:863(gdb) 

 

reply报文的处理过程:

(gdb) #0  SQUID_MD5Final (digest=0x764d20 "\237:\027", ctx=0x7fff811ceb70) at md5.c:131#1  0x0000000000489c02 in storeKeyPrivate (url=0x1cad2c0 "http://127.0.0.1:70/hello", method=1, id=2)    at store_key_md5.c:106#2  0x0000000000480b00 in storeSetPrivateKey (e=0x1c81d80) at store.c:407#3  0x000000000048329e in storeSetPublicKey (e=0x1cad3e0) at store.c:1070#4  0x000000000044ef4e in httpMakePublic (entry=0x1cad3e0) at http.c:115#5  0x00000000004500cd in httpProcessReplyHeader (httpState=0x1cada28,     buf=0x70cee0 "HTTP/1.0 200 OK\r\nAge: 3000\r\nCache-control: public,max-age=6000\r\nLast-modified: Mon,09 Jun 2014 06:20:32 GMT\r\nExpire: Mon,16 Jun 2014 06:20:32 GMT\r\nEtag: ", x <repeats 16 times>, "\r\nContent-Type: text; charset=I"..., size=272) at http.c:565#6  0x00000000004515b6 in httpReadReply (fd=17, data=http://www.mamicode.com/0x1cada28) at http.c:970#7  0x0000000000432bd9 in comm_call_handlers (fd=17, read_event=1, write_event=0) at comm_generic.c:264#8  0x00000000004334de in do_comm_select (msec=983) at comm_epoll.c:195#9  0x0000000000432fc3 in comm_select (msec=983) at comm_generic.c:390#10 0x0000000000466c9a in main (argc=2, argv=0x7fff811cf088) at main.c:863