Hex Artifact Content
Not logged in

Artifact 9fdac5818bcf86f547ddad54dea1db99e5a28e59:

Ticket change [9fdac5818b] - New ticket [da3fef0b21] Bug in http.c: missing \r for Proxy-Authorization header. by anonymous 2011-05-13 13:59:08.
0000: 44 20 32 30 31 31 2d 30 35 2d 31 33 54 31 33 3a  D 2011-05-13T13:
0010: 35 39 3a 30 38 2e 38 33 30 0a 4a 20 63 6f 6d 6d  59:08.830.J comm
0020: 65 6e 74 20 45 61 73 69 65 73 74 5c 73 74 6f 5c  ent Easiest\sto\
0030: 73 73 68 6f 77 5c 73 74 68 65 5c 73 62 75 67 5c  sshow\sthe\sbug\
0040: 73 62 79 5c 73 6a 75 73 74 5c 73 73 68 6f 77 69  sby\sjust\sshowi
0050: 6e 67 5c 73 74 68 65 5c 73 70 61 74 63 68 3a 5c  ng\sthe\spatch:\
0060: 72 5c 6e 5c 72 5c 6e 3c 6e 6f 77 69 6b 69 3e 3c  r\n\r\n<nowiki><
0070: 70 72 65 3e 5c 72 5c 6e 2d 2d 2d 5c 73 73 72 63  pre>\r\n---\ssrc
0080: 2f 68 74 74 70 2e 63 5c 72 5c 6e 2b 2b 2b 5c 73  /http.c\r\n+++\s
0090: 73 72 63 2f 68 74 74 70 2e 63 5c 72 5c 6e 40 40  src/http.c\r\n@@
00a0: 5c 73 2d 31 30 30 2c 31 31 5c 73 2b 31 30 30 2c  \s-100,11\s+100,
00b0: 31 31 5c 73 40 40 5c 72 5c 6e 5c 73 5c 73 5c 73  11\s@@\r\n\s\s\s
00c0: 7d 65 6c 73 65 7b 5c 72 5c 6e 5c 73 5c 73 5c 73  }else{\r\n\s\s\s
00d0: 5c 73 5c 73 7a 53 65 70 5c 73 3d 5c 73 22 2f 22  \s\szSep\s=\s"/"
00e0: 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 7d 5c 72 5c 6e  ;\r\n\s\s\s}\r\n
00f0: 5c 73 5c 73 5c 73 62 6c 6f 62 5f 61 70 70 65 6e  \s\s\sblob_appen
0100: 64 66 28 70 48 64 72 2c 5c 73 22 50 4f 53 54 5c  df(pHdr,\s"POST\
0110: 73 25 73 25 73 78 66 65 72 2f 78 66 65 72 5c 73  s%s%sxfer/xfer\s
0120: 48 54 54 50 2f 31 2e 30 5c 5c 72 5c 5c 6e 22 2c  HTTP/1.0\\r\\n",
0130: 5c 73 67 2e 75 72 6c 50 61 74 68 2c 5c 73 7a 53  \sg.urlPath,\szS
0140: 65 70 29 3b 5c 72 5c 6e 5c 73 5c 73 5c 73 69 66  ep);\r\n\s\s\sif
0150: 28 5c 73 67 2e 75 72 6c 50 72 6f 78 79 41 75 74  (\sg.urlProxyAut
0160: 68 5c 73 29 7b 5c 72 5c 6e 2d 5c 73 5c 73 5c 73  h\s){\r\n-\s\s\s
0170: 5c 73 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28 70  \sblob_appendf(p
0180: 48 64 72 2c 5c 73 22 50 72 6f 78 79 2d 41 75 74  Hdr,\s"Proxy-Aut
0190: 68 6f 72 69 7a 61 74 69 6f 6e 3a 5c 73 25 73 5c  horization:\s%s\
01a0: 5c 6e 22 2c 5c 73 67 2e 75 72 6c 50 72 6f 78 79  \n",\sg.urlProxy
01b0: 41 75 74 68 29 3b 5c 72 5c 6e 2b 5c 73 5c 73 5c  Auth);\r\n+\s\s\
01c0: 73 5c 73 62 6c 6f 62 5f 61 70 70 65 6e 64 66 28  s\sblob_appendf(
01d0: 70 48 64 72 2c 5c 73 22 50 72 6f 78 79 2d 41 75  pHdr,\s"Proxy-Au
01e0: 74 68 6f 72 69 7a 61 74 69 6f 6e 3a 5c 73 25 73  thorization:\s%s
01f0: 5c 5c 72 5c 5c 6e 22 2c 5c 73 67 2e 75 72 6c 50  \\r\\n",\sg.urlP
0200: 72 6f 78 79 41 75 74 68 29 3b 5c 72 5c 6e 5c 73  roxyAuth);\r\n\s
0210: 5c 73 5c 73 7d 5c 72 5c 6e 5c 73 5c 73 5c 73 69  \s\s}\r\n\s\s\si
0220: 66 28 5c 73 67 2e 75 72 6c 50 61 73 73 77 64 5c  f(\sg.urlPasswd\
0230: 73 26 26 5c 73 67 2e 75 72 6c 55 73 65 72 5c 73  s&&\sg.urlUser\s
0240: 26 26 5c 73 67 2e 75 72 6c 50 61 73 73 77 64 5b  &&\sg.urlPasswd[
0250: 30 5d 3d 3d 27 23 27 5c 73 29 7b 5c 72 5c 6e 5c  0]=='#'\s){\r\n\
0260: 73 5c 73 5c 73 5c 73 5c 73 63 68 61 72 5c 73 2a  s\s\s\s\schar\s*
0270: 7a 43 72 65 64 65 6e 74 69 61 6c 73 5c 73 3d 5c  zCredentials\s=\
0280: 73 6d 70 72 69 6e 74 66 28 22 25 73 3a 25 73 22  smprintf("%s:%s"
0290: 2c 5c 73 67 2e 75 72 6c 55 73 65 72 2c 5c 73 26  ,\sg.urlUser,\s&
02a0: 67 2e 75 72 6c 50 61 73 73 77 64 5b 31 5d 29 3b  g.urlPasswd[1]);
02b0: 5c 72 5c 6e 5c 73 5c 73 5c 73 5c 73 5c 73 63 68  \r\n\s\s\s\s\sch
02c0: 61 72 5c 73 2a 7a 45 6e 63 6f 64 65 64 5c 73 3d  ar\s*zEncoded\s=
02d0: 5c 73 65 6e 63 6f 64 65 36 34 28 7a 43 72 65 64  \sencode64(zCred
02e0: 65 6e 74 69 61 6c 73 2c 5c 73 2d 31 29 3b 5c 72  entials,\s-1);\r
02f0: 5c 6e 5c 73 5c 73 5c 73 5c 73 5c 73 62 6c 6f 62  \n\s\s\s\s\sblob
0300: 5f 61 70 70 65 6e 64 66 28 70 48 64 72 2c 5c 73  _appendf(pHdr,\s
0310: 22 41 75 74 68 6f 72 69 7a 61 74 69 6f 6e 3a 5c  "Authorization:\
0320: 73 42 61 73 69 63 5c 73 25 73 5c 5c 72 5c 5c 6e  sBasic\s%s\\r\\n
0330: 22 2c 5c 73 7a 45 6e 63 6f 64 65 64 29 3b 5c 72  ",\szEncoded);\r
0340: 5c 6e 3c 2f 70 72 65 3e 3c 2f 6e 6f 77 69 6b 69  \n</pre></nowiki
0350: 3e 5c 72 5c 6e 5c 72 5c 6e 41 6c 6c 5c 73 48 54  >\r\n\r\nAll\sHT
0360: 54 50 5c 73 68 65 61 64 65 72 73 5c 73 73 68 6f  TP\sheaders\ssho
0370: 75 6c 64 5c 73 62 65 5c 73 74 65 72 6d 69 6e 61  uld\sbe\stermina
0380: 74 65 64 5c 73 62 79 5c 73 61 5c 73 43 52 4c 46  ted\sby\sa\sCRLF
0390: 5c 73 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 5c 73  \scombination,\s
03a0: 6e 6f 74 5c 73 6a 75 73 74 5c 73 61 6e 5c 73 4c  not\sjust\san\sL
03b0: 46 2e 5c 73 5c 73 57 69 74 68 6f 75 74 5c 73 74  F.\s\sWithout\st
03c0: 68 65 5c 73 70 72 6f 70 65 72 5c 73 74 65 72 6d  he\sproper\sterm
03d0: 69 6e 61 74 69 6f 6e 2c 5c 73 73 6f 6d 65 5c 73  ination,\ssome\s
03e0: 73 65 72 76 65 72 73 5c 73 6d 61 79 5c 73 72 65  servers\smay\sre
03f0: 6a 65 63 74 5c 73 74 68 65 5c 73 68 65 61 64 65  ject\sthe\sheade
0400: 72 2e 0a 4a 20 66 6f 75 6e 64 69 6e 20 32 30 31  r..J foundin 201
0410: 31 2d 30 35 2d 31 32 5c 73 31 34 3a 35 36 3a 35  1-05-12\s14:56:5
0420: 32 5c 73 64 38 32 32 31 62 39 38 36 33 36 62 37  2\sd8221b98636b7
0430: 36 63 66 64 39 39 63 62 36 63 63 63 65 30 65 32  6cfd99cb6ccce0e2
0440: 34 66 35 62 61 61 61 66 65 35 31 0a 4a 20 73 65  4f5baaafe51.J se
0450: 76 65 72 69 74 79 20 4d 69 6e 6f 72 0a 4a 20 73  verity Minor.J s
0460: 74 61 74 75 73 20 4f 70 65 6e 0a 4a 20 74 69 74  tatus Open.J tit
0470: 6c 65 20 42 75 67 5c 73 69 6e 5c 73 68 74 74 70  le Bug\sin\shttp
0480: 2e 63 3a 5c 73 6d 69 73 73 69 6e 67 5c 73 5c 5c  .c:\smissing\s\\
0490: 72 5c 73 66 6f 72 5c 73 50 72 6f 78 79 2d 41 75  r\sfor\sProxy-Au
04a0: 74 68 6f 72 69 7a 61 74 69 6f 6e 5c 73 68 65 61  thorization\shea
04b0: 64 65 72 0a 4a 20 74 79 70 65 20 43 6f 64 65 5f  der.J type Code_
04c0: 44 65 66 65 63 74 0a 4b 20 64 61 33 66 65 66 30  Defect.K da3fef0
04d0: 62 32 31 63 33 37 64 37 65 34 61 61 36 31 31 65  b21c37d7e4aa611e
04e0: 63 30 38 30 37 36 66 65 38 61 66 32 65 65 65 33  c08076fe8af2eee3
04f0: 35 0a 55 20 61 6e 6f 6e 79 6d 6f 75 73 0a 5a 20  5.U anonymous.Z 
0500: 33 36 38 64 62 64 39 66 35 34 32 34 35 32 32 62  368dbd9f5424522b
0510: 65 33 39 36 38 30 63 64 61 31 38 36 32 31 37 37  e39680cda1862177
0520: 0a                                               .