After upgrading from 5.0.3 to 5.1.0, the Nagios probe used for SAM tests fails:
https://gitlab.cern.ch/lcgdm/nagios-plugins-webdav/-/blob/master/src/check_webdav

I reduced this lengthy, Python2-only reproducer to the following short program (as compared to the probe, it works with Python 3, and enforces chunked transfers also with modern curl libraries):

#!/usr/bin/env python

import os
import pycurl

curl = pycurl.Curl()
#curl.setopt(pycurl.FOLLOWLOCATION, 1)

curl.setopt(pycurl.CAINFO, os.getenv("X509_USER_PROXY"))
curl.setopt(pycurl.SSLCERT, os.getenv("X509_USER_PROXY"))
curl.setopt(pycurl.CAPATH, "/etc/grid-security/certificates")
curl.setopt(pycurl.URL, "https://my-server:1094/data/some/path/testfile")
curl.setopt(pycurl.HTTPHEADER, ["Transfer-Encoding: chunked"])

TEST_DATA = "This is some text 0x1d bytes."

curl.setopt(curl.VERBOSE, 1)

def print_traffic(msg_kind, msg):
  if msg_kind < 1 or msg_kind > 4:
    return
  if msg_kind % 2 ==0:
    print("[%2d]> %s" % (msg_kind, str(msg)))
  elif msg_kind % 2 == 1:
    print("[%2d]< %s"  % (msg_kind, str(msg)))

curl.setopt(pycurl.DEBUGFUNCTION, lambda x, y: print_traffic(x, y))

class StringReader:
  def __init__(self, data):
    self.pos = 0
    self.data = data
  def read(self, size):
    ret = self.data[self.pos:self.pos+size]
    self.pos=self.pos+size

    if len(ret) == 0:
      self.pos = 0
    return ret

curl.setopt(pycurl.UPLOAD, 1)
stringreader = StringReader(TEST_DATA)
curl.setopt(pycurl.READFUNCTION, stringreader.read)

curl.perform()

print(curl.getinfo(pycurl.HTTP_CODE))

Running this against XRootD 5.0.3 shows:

[ 2]> b'PUT /data/some/path/testfile HTTP/1.1\r\nHost: my-server:1094\r\nUser-Agent: PycURL/7.43.0.6 libcurl/7.74.0 (NSS/3.60.1) OpenSSL/1.1.1j zlib/1.2.11 c-ares/1.17.1 libidn2/2.3.0 libssh2/1.9.0_DEV nghttp2/1.41.0 librtmp/2.3\r\nAccept: */*\r\nTransfer-Encoding: chunked\r\nExpect: 100-continue\r\n\r\n'
[ 1]< b'HTTP/1.1 100 Continue\r\n'
[ 1]< b'Connection: Close\r\n'
[ 4]> b'1d\r\nThis is some text 0x1d bytes.\r\n'
[ 4]> b'0\r\n\r\n'
[ 1]< b'HTTP/1.1 200 OK\r\n'
[ 1]< b'Connection: Keep-Alive\r\n'
[ 1]< b'Content-Length: 3\r\n'
[ 1]< b'\r\n'
[ 3]< b':-)'
200
:-)

However, against XRootD 5.1.0 I get:

[ 2]> b'PUT /data/some/path/testfile HTTP/1.1\r\nHost: my-server:1094\r\nUser-Agent: PycURL/7.43.0.6 libcurl/7.74.0 (NSS/3.60.1) OpenSSL/1.1.1j zlib/1.2.11 c-ares/1.17.1 libidn2/2.3.0 libssh2/1.9.0_DEV nghttp2/1.41.0 librtmp/2.3\r\nAccept: */*\r\nTransfer-Encoding: chunked\r\nExpect: 100-continue\r\n\r\n'
[ 1]< b'HTTP/1.1 100 Continue\r\n'
[ 1]< b'Connection: Close\r\n'
[ 1]< b'HTTP/1.1 400 Unknown\r\n'
[ 1]< b'Connection: Close\r\n'
[ 1]< b'Content-Length: 24\r\n'
[ 1]< b'\r\n'
[ 4]> b'1d\r\nThis is some text 0x1d bytes.\r\n'
[ 3]< b'Invalid chunked encoding'
400
Invalid chunked encoding

This breaks EGI SAM tests.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/xrootd/xrootd/issues/1411", "url": "https://github.com/xrootd/xrootd/issues/1411", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1