@ttsc/darwin-x64 0.32.1 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/bin/go/VERSION +2 -2
  2. package/bin/go/bin/go +0 -0
  3. package/bin/go/bin/gofmt +0 -0
  4. package/bin/go/pkg/tool/darwin_amd64/asm +0 -0
  5. package/bin/go/pkg/tool/darwin_amd64/cgo +0 -0
  6. package/bin/go/pkg/tool/darwin_amd64/compile +0 -0
  7. package/bin/go/pkg/tool/darwin_amd64/cover +0 -0
  8. package/bin/go/pkg/tool/darwin_amd64/fix +0 -0
  9. package/bin/go/pkg/tool/darwin_amd64/link +0 -0
  10. package/bin/go/pkg/tool/darwin_amd64/preprofile +0 -0
  11. package/bin/go/pkg/tool/darwin_amd64/vet +0 -0
  12. package/bin/go/src/crypto/internal/fips140/mlkem/cast.go +66 -36
  13. package/bin/go/src/crypto/internal/fips140/mlkem/mlkem768.go +6 -0
  14. package/bin/go/src/crypto/tls/ech.go +18 -4
  15. package/bin/go/src/go.mod +1 -1
  16. package/bin/go/src/go.sum +2 -2
  17. package/bin/go/src/html/template/js.go +8 -3
  18. package/bin/go/src/html/template/transition.go +8 -1
  19. package/bin/go/src/internal/buildcfg/zbootstrap.go +1 -1
  20. package/bin/go/src/internal/godebugs/table.go +1 -0
  21. package/bin/go/src/internal/poll/fd_windows.go +21 -1
  22. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_arm.go +3 -3
  23. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_arm64.go +3 -3
  24. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_loong64.go +2 -2
  25. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_mips64x.go +2 -2
  26. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_mipsx.go +1 -1
  27. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_ppc64x.go +2 -2
  28. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_riscv64.go +2 -2
  29. package/bin/go/src/internal/runtime/syscall/linux/defs_linux_s390x.go +2 -2
  30. package/bin/go/src/internal/syscall/windows/at_windows.go +91 -15
  31. package/bin/go/src/internal/syscall/windows/types_windows.go +8 -1
  32. package/bin/go/src/mime/multipart/formdata.go +4 -5
  33. package/bin/go/src/net/http/fs.go +28 -0
  34. package/bin/go/src/net/http/h2_bundle.go +278 -133
  35. package/bin/go/src/net/http/httputil/reverseproxy.go +15 -0
  36. package/bin/go/src/net/http/server.go +23 -3
  37. package/bin/go/src/net/http/transport.go +6 -1
  38. package/bin/go/src/net/textproto/reader.go +9 -7
  39. package/bin/go/src/os/file_windows.go +7 -3
  40. package/bin/go/src/os/root_openat.go +5 -5
  41. package/bin/go/src/os/root_unix.go +4 -0
  42. package/bin/go/src/os/root_windows.go +8 -2
  43. package/bin/go/src/runtime/metrics/doc.go +5 -0
  44. package/bin/go/src/runtime/netpoll_epoll.go +20 -7
  45. package/bin/go/src/runtime/os_windows.go +23 -0
  46. package/bin/go/src/vendor/modules.txt +1 -1
  47. package/bin/ttsc +0 -0
  48. package/bin/ttsc-cache +0 -0
  49. package/bin/ttscserver +0 -0
  50. package/package.json +2 -1
@@ -531,6 +531,21 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
531
531
  }
532
532
  }
533
533
 
534
+ if outreq.Method == "CONNECT" {
535
+ // We cannot handle CONNECT requests.
536
+ // (Perhaps we should just send a 405 and never call ErrorHandler?
537
+ // More consistent to always call ErrorHandler or ModifyResponse,
538
+ // so we do that for now.)
539
+ err := errors.New("client sent unsupported CONNECT request")
540
+ if p.ErrorHandler != nil {
541
+ p.ErrorHandler(rw, outreq, err)
542
+ } else {
543
+ p.logf("http: proxy error: %v", err)
544
+ rw.WriteHeader(http.StatusMethodNotAllowed)
545
+ }
546
+ return
547
+ }
548
+
534
549
  if _, ok := outreq.Header["User-Agent"]; !ok {
535
550
  // If the outbound request doesn't have a User-Agent header set,
536
551
  // don't send the default Go HTTP client User-Agent.
@@ -1253,7 +1253,11 @@ func (cw *chunkWriter) writeHeader(p []byte) {
1253
1253
 
1254
1254
  w := cw.res
1255
1255
  keepAlivesEnabled := w.conn.server.doKeepAlives()
1256
- isHEAD := w.req.Method == "HEAD"
1256
+
1257
+ // Consult w.conn.lastMethod instead of w.req.Method,
1258
+ // just in case a middleware layer modified w.req.
1259
+ isHEAD := w.conn.lastMethod == "HEAD"
1260
+ isCONNECT := w.conn.lastMethod == "CONNECT"
1257
1261
 
1258
1262
  // header is written out to w.conn.buf below. Depending on the
1259
1263
  // state of the handler, we either own the map or not. If we
@@ -1365,6 +1369,11 @@ func (cw *chunkWriter) writeHeader(p []byte) {
1365
1369
  w.closeAfterReply = true
1366
1370
  }
1367
1371
 
1372
+ if isCONNECT {
1373
+ // Don't reuse a connection after a CONNECT, even if we reject it.
1374
+ w.closeAfterReply = true
1375
+ }
1376
+
1368
1377
  // We do this by default because there are a number of clients that
1369
1378
  // send a full request before starting to read the response, and they
1370
1379
  // can deadlock if we start writing the response with unconsumed body
@@ -1464,7 +1473,13 @@ func (cw *chunkWriter) writeHeader(p []byte) {
1464
1473
  hasCL = false
1465
1474
  }
1466
1475
 
1467
- if w.req.Method == "HEAD" || !bodyAllowedForStatus(code) || code == StatusNoContent {
1476
+ isSuccessfulCONNECT := isCONNECT && code >= 200 && code < 300
1477
+ if isSuccessfulCONNECT {
1478
+ // Tunnel established, connection is no longer HTTP.
1479
+ delHeader("Transfer-Encoding")
1480
+ delHeader("Content-Length")
1481
+ setHeader.contentLength = nil
1482
+ } else if isHEAD || !bodyAllowedForStatus(code) || code == StatusNoContent {
1468
1483
  // Response has no body.
1469
1484
  delHeader("Transfer-Encoding")
1470
1485
  } else if hasCL {
@@ -1514,8 +1529,13 @@ func (cw *chunkWriter) writeHeader(p []byte) {
1514
1529
  !isProtocolSwitchResponse(w.status, header)
1515
1530
  if delConnectionHeader {
1516
1531
  delHeader("Connection")
1517
- if w.req.ProtoAtLeast(1, 1) {
1532
+ // Don't set Connection: close on a 2xx CONNECT response,
1533
+ // even though we will close the connection if the handler doesn't hijack it.
1534
+ // If the handler does hijack the connection, the Connection: close is confusing.
1535
+ if w.req.ProtoAtLeast(1, 1) && !isSuccessfulCONNECT {
1518
1536
  setHeader.connection = "close"
1537
+ } else {
1538
+ setHeader.connection = ""
1519
1539
  }
1520
1540
  }
1521
1541
 
@@ -2367,12 +2367,17 @@ func (pc *persistConn) readLoop() {
2367
2367
  pc.mu.Unlock()
2368
2368
 
2369
2369
  bodyWritable := resp.bodyIsWritable()
2370
+ isConnect := rc.treq.Request.Method == "CONNECT"
2370
2371
  hasBody := rc.treq.Request.Method != "HEAD" && resp.ContentLength != 0
2371
2372
 
2372
- if resp.Close || rc.treq.Request.Close || resp.StatusCode <= 199 || bodyWritable {
2373
+ if resp.Close || rc.treq.Request.Close || resp.StatusCode <= 199 || bodyWritable || isConnect {
2373
2374
  // Don't do keep-alive on error if either party requested a close
2374
2375
  // or we get an unexpected informational (1xx) response.
2375
2376
  // StatusCode 100 is already handled above.
2377
+ //
2378
+ // Don't do keep-alive after sending a CONNECT request.
2379
+ // Only a 2xx response converts the connection into a tunnel,
2380
+ // but for safety we'll drop the connection even after getting a non-2xx.
2376
2381
  alive = false
2377
2382
  }
2378
2383
 
@@ -180,7 +180,7 @@ func (r *Reader) readContinuedLineSlice(lim int64, validateFirstLine func([]byte
180
180
  }
181
181
  line, err := r.readLineSlice(lim - int64(len(r.buf)))
182
182
  if err != nil {
183
- break
183
+ return nil, err
184
184
  }
185
185
  r.buf = append(r.buf, trim(line)...)
186
186
  }
@@ -514,6 +514,10 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) {
514
514
  // readMIMEHeader is a version of ReadMIMEHeader which takes a limit on the header size.
515
515
  // It is called by the mime/multipart package.
516
516
  func readMIMEHeader(r *Reader, maxMemory, maxHeaders int64) (MIMEHeader, error) {
517
+ if maxMemory < 0 {
518
+ return nil, errMessageTooLarge
519
+ }
520
+
517
521
  // Avoid lots of small slice allocations later by allocating one
518
522
  // large one ahead of time which we'll cut up into smaller
519
523
  // slices. If this isn't big enough later, we allocate small ones.
@@ -528,12 +532,6 @@ func readMIMEHeader(r *Reader, maxMemory, maxHeaders int64) (MIMEHeader, error)
528
532
 
529
533
  m := make(MIMEHeader, hint)
530
534
 
531
- // Account for 400 bytes of overhead for the MIMEHeader, plus 200 bytes per entry.
532
- // Benchmarking map creation as of go1.20, a one-entry MIMEHeader is 416 bytes and large
533
- // MIMEHeaders average about 200 bytes per entry.
534
- maxMemory -= 400
535
- const mapEntryOverhead = 200
536
-
537
535
  // The first line cannot start with a leading space.
538
536
  if buf, err := r.R.Peek(1); err == nil && (buf[0] == ' ' || buf[0] == '\t') {
539
537
  const errorLimit = 80 // arbitrary limit on how much of the line we'll quote
@@ -575,6 +573,10 @@ func readMIMEHeader(r *Reader, maxMemory, maxHeaders int64) (MIMEHeader, error)
575
573
 
576
574
  vv := m[key]
577
575
  if vv == nil {
576
+ // Account for per-entry overhead.
577
+ // 200 bytes is based on benchmarks circa Go 1.20.
578
+ const mapEntryOverhead = 200
579
+
578
580
  maxMemory -= int64(len(key))
579
581
  maxMemory -= mapEntryOverhead
580
582
  }
@@ -100,11 +100,15 @@ func newFile(h syscall.Handle, name string, kind newFileKind, nonBlocking bool)
100
100
  panic("newFile with unknown kind")
101
101
  }
102
102
 
103
+ // Completion notification modes are shared by all handles to the file
104
+ // object. Preserve them for handles passed to NewFile, since other users
105
+ // of the file object may rely on those modes. See go.dev/issue/80979.
103
106
  f := &File{&file{
104
107
  pfd: poll.FD{
105
- Sysfd: h,
106
- IsStream: true,
107
- ZeroReadIsEOF: true,
108
+ Sysfd: h,
109
+ IsStream: true,
110
+ ZeroReadIsEOF: true,
111
+ KeepFileCompletionModes: kind == kindNewFile,
108
112
  },
109
113
  name: name,
110
114
  }}
@@ -153,13 +153,13 @@ func rootMkdirAll(r *Root, fullname string, perm FileMode) error {
153
153
  openLastComponentFunc := func(parent sysfdType, name string, endsInSlash bool) (struct{}, error) {
154
154
  err := mkdirat(parent, name, perm)
155
155
  if err == syscall.EEXIST {
156
- mode, e := modeAt(parent, name)
156
+ fi, e := lstatat(parent, name)
157
157
  if e == nil {
158
- if mode.IsDir() {
158
+ if fi.Mode().IsDir() {
159
159
  // The target of MkdirAll is an existing directory.
160
160
  err = nil
161
- } else if mode&ModeSymlink != 0 {
162
- // The target of MkdirAll is a symlink.
161
+ } else if isLink(fi) {
162
+ // The target of MkdirAll is a symlink or junction.
163
163
  // For consistency with os.MkdirAll,
164
164
  // succeed if the link resolves to a directory.
165
165
  // We don't return errSymlink here, because we don't
@@ -420,7 +420,7 @@ Loop:
420
420
  case err != nil:
421
421
  return
422
422
  case fi.Mode().Type() == fs.ModeDir:
423
- case fi.Mode().Type() == fs.ModeSymlink:
423
+ case isLink(fi):
424
424
  if runtime.GOOS != "windows" || flags&doInRootAlwaysResolveTerminalSlash != 0 {
425
425
  err = checkSymlink(dirfd, parts[i], syscall.ENOTDIR)
426
426
  } else {
@@ -306,6 +306,10 @@ func readlinkat(fd int, name string) (string, error) {
306
306
  }
307
307
  }
308
308
 
309
+ func isLink(fi FileInfo) bool {
310
+ return fi.Mode()&ModeSymlink != 0
311
+ }
312
+
309
313
  // isDirectoryLink always returns false, because Unix systems don't have separate
310
314
  // symlink types for files and directories.
311
315
  // (See the Windows version of this function for more details.)
@@ -421,8 +421,14 @@ func lstatat(parent syscall.Handle, name string) (FileInfo, error) {
421
421
  return fi, nil
422
422
  }
423
423
 
424
- // isDirectoryLink reports whether fi (assumed to be a symlink) is a directory link.
425
- // Windows symlinks come in two flavors: file and directory. This function distinguishes
424
+ // isLink reports whether fi is a symlink or other surrogate reparse point (such as a junction).
425
+ func isLink(fi FileInfo) bool {
426
+ fs, ok := fi.(*fileStat)
427
+ return ok && fs.isReparseTagNameSurrogate()
428
+ }
429
+
430
+ // isDirectoryLink reports whether fi (assumed to be a link) is a directory link.
431
+ // Windows links come in two flavors: file and directory. This function distinguishes
426
432
  // between the two.
427
433
  func isDirectoryLink(fi FileInfo) bool {
428
434
  fs, ok := fi.(*fileStat)
@@ -342,6 +342,11 @@ Below is the full list of supported metrics, ordered lexicographically.
342
342
  by the net/http package due to a non-default
343
343
  GODEBUG=httpservecontentkeepheaders=... setting.
344
344
 
345
+ /godebug/non-default-behavior/httpservecontentmaxranges:events
346
+ The number of non-default behaviors executed
347
+ by the net/http package due to a non-default
348
+ GODEBUG=httpservecontentmaxranges=... setting.
349
+
345
350
  /godebug/non-default-behavior/installgoroot:events
346
351
  The number of non-default behaviors executed by the go/build
347
352
  package due to a non-default GODEBUG=installgoroot=... setting.
@@ -18,6 +18,21 @@ var (
18
18
  netpollWakeSig atomic.Uint32 // used to avoid duplicate calls of netpollBreak
19
19
  )
20
20
 
21
+ // netpollPackData stores pd and its fdseq in the epoll data field of ev as
22
+ // a taggedPointer. A nil pd marks the netpollBreak eventfd: netpollopen always
23
+ // registers a non-nil *pollDesc, so netpollUnpackData can tell the two apart
24
+ // by the pointer alone, on any word size or endianness.
25
+ func netpollPackData(ev *linux.EpollEvent, pd *pollDesc, fdseq uintptr) {
26
+ *(*taggedPointer)(unsafe.Pointer(&ev.Data)) = taggedPointerPack(unsafe.Pointer(pd), fdseq)
27
+ }
28
+
29
+ // netpollUnpackData returns the pollDesc and fdseq stored by netpollPackData.
30
+ // pd is nil for the netpollBreak eventfd.
31
+ func netpollUnpackData(ev *linux.EpollEvent) (pd *pollDesc, fdseq uintptr) {
32
+ tp := *(*taggedPointer)(unsafe.Pointer(&ev.Data))
33
+ return (*pollDesc)(tp.pointer()), tp.tag()
34
+ }
35
+
21
36
  func netpollinit() {
22
37
  var errno uintptr
23
38
  epfd, errno = linux.EpollCreate1(linux.EPOLL_CLOEXEC)
@@ -33,7 +48,7 @@ func netpollinit() {
33
48
  ev := linux.EpollEvent{
34
49
  Events: linux.EPOLLIN,
35
50
  }
36
- *(**uintptr)(unsafe.Pointer(&ev.Data)) = &netpollEventFd
51
+ netpollPackData(&ev, nil, 0)
37
52
  errno = linux.EpollCtl(epfd, linux.EPOLL_CTL_ADD, efd, &ev)
38
53
  if errno != 0 {
39
54
  println("runtime: epollctl failed with", errno)
@@ -49,8 +64,7 @@ func netpollIsPollDescriptor(fd uintptr) bool {
49
64
  func netpollopen(fd uintptr, pd *pollDesc) uintptr {
50
65
  var ev linux.EpollEvent
51
66
  ev.Events = linux.EPOLLIN | linux.EPOLLOUT | linux.EPOLLRDHUP | linux.EPOLLET
52
- tp := taggedPointerPack(unsafe.Pointer(pd), pd.fdseq.Load())
53
- *(*taggedPointer)(unsafe.Pointer(&ev.Data)) = tp
67
+ netpollPackData(&ev, pd, pd.fdseq.Load())
54
68
  return linux.EpollCtl(epfd, linux.EPOLL_CTL_ADD, int32(fd), &ev)
55
69
  }
56
70
 
@@ -137,7 +151,9 @@ retry:
137
151
  continue
138
152
  }
139
153
 
140
- if *(**uintptr)(unsafe.Pointer(&ev.Data)) == &netpollEventFd {
154
+ pd, tag := netpollUnpackData(&ev)
155
+ // pd == nil denotes a netpollBreak eventfd.
156
+ if pd == nil {
141
157
  if ev.Events != linux.EPOLLIN {
142
158
  println("runtime: netpoll: eventfd ready for", ev.Events)
143
159
  throw("runtime: netpoll: eventfd ready for something unexpected")
@@ -163,9 +179,6 @@ retry:
163
179
  mode += 'w'
164
180
  }
165
181
  if mode != 0 {
166
- tp := *(*taggedPointer)(unsafe.Pointer(&ev.Data))
167
- pd := (*pollDesc)(tp.pointer())
168
- tag := tp.tag()
169
182
  if pd.fdseq.Load() == tag {
170
183
  pd.setEventErr(ev.Events == linux.EPOLLERR, tag)
171
184
  delta += netpollready(&toRun, pd, mode)
@@ -1149,6 +1149,23 @@ const preemptMSupported = true
1149
1149
  // suspending each other.
1150
1150
  var suspendLock mutex
1151
1151
 
1152
+ // threadPausedLockRank warns the runtime against acquiring new locks on this
1153
+ // thread while it has another thread paused. The holder of this lock rank is
1154
+ // effectively a signal handler for a paused thread, which may be holding
1155
+ // arbitrary locks.
1156
+ //
1157
+ // The warning takes two concrete forms: First, unlock2 will see that this
1158
+ // thread is holding other locks, so won't try to flush the mutex contention
1159
+ // buffer (which can involve acquiring another lock). Second, builds with
1160
+ // GOEXPERIMENT=staticlockranking (currently broken, https://go.dev/issue/76058)
1161
+ // will report a rank violation.
1162
+ //
1163
+ // suspendLock serializes the transition into "suspended", but it's fine for
1164
+ // multiple threads to be in the suspended state concurrently, with each of
1165
+ // their sponsors independently using threadPausedLockRank to discourage
1166
+ // themselves from acquiring new locks.
1167
+ const threadPausedLockRank = lockRankLeafRank
1168
+
1152
1169
  func preemptM(mp *m) {
1153
1170
  if mp == getg().m {
1154
1171
  throw("self-preempt")
@@ -1191,6 +1208,9 @@ func preemptM(mp *m) {
1191
1208
  // actually suspended.
1192
1209
  lock(&suspendLock)
1193
1210
 
1211
+ // Signal handler rules are in effect; don't acquire new locks.
1212
+ acquireLockRankAndM(threadPausedLockRank)
1213
+
1194
1214
  // Suspend the thread.
1195
1215
  if int32(stdcall(_SuspendThread, thread)) == -1 {
1196
1216
  unlock(&suspendLock)
@@ -1199,6 +1219,7 @@ func preemptM(mp *m) {
1199
1219
  // The thread no longer exists. This shouldn't be
1200
1220
  // possible, but just acknowledge the request.
1201
1221
  mp.preemptGen.Add(1)
1222
+ releaseLockRankAndM(threadPausedLockRank)
1202
1223
  return
1203
1224
  }
1204
1225
 
@@ -1233,6 +1254,8 @@ func preemptM(mp *m) {
1233
1254
 
1234
1255
  stdcall(_ResumeThread, thread)
1235
1256
  stdcall(_CloseHandle, thread)
1257
+
1258
+ releaseLockRankAndM(threadPausedLockRank)
1236
1259
  }
1237
1260
 
1238
1261
  // osPreemptExtEnter is called before entering external code that may
@@ -6,7 +6,7 @@ golang.org/x/crypto/cryptobyte
6
6
  golang.org/x/crypto/cryptobyte/asn1
7
7
  golang.org/x/crypto/internal/alias
8
8
  golang.org/x/crypto/internal/poly1305
9
- # golang.org/x/net v0.47.1-0.20260731170545-cb1d721f7fb3
9
+ # golang.org/x/net v0.47.1-0.20260925170545-1431957440b7
10
10
  ## explicit; go 1.24.0
11
11
  golang.org/x/net/dns/dnsmessage
12
12
  golang.org/x/net/http/httpguts
package/bin/ttsc CHANGED
Binary file
package/bin/ttsc-cache ADDED
Binary file
package/bin/ttscserver CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/darwin-x64",
3
- "version": "0.32.1",
3
+ "version": "0.33.0",
4
4
  "description": "macOS x64 native ttsc/ttscserver binaries and bundled Go compiler for ttsc.",
5
5
  "os": [
6
6
  "darwin"
@@ -24,6 +24,7 @@
24
24
  "executableFiles": [
25
25
  "./bin/ttsc",
26
26
  "./bin/ttscserver",
27
+ "./bin/ttsc-cache",
27
28
  "./bin/go/bin/go",
28
29
  "./bin/go/bin/gofmt",
29
30
  "./bin/go/pkg/tool/darwin_amd64/asm",