Bug 619741 - Content-Length is not set in HTTP Headers from RHN Satellite, if the response exceeds 8kb
Summary: Content-Length is not set in HTTP Headers from RHN Satellite, if the response...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite Proxy 5
Classification: Red Hat
Component: Server
Version: 530
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Dimitar Yordanov
URL:
Whiteboard:
Depends On:
Blocks: sat540-blockers sat531-triage sat540-api, sat540-apis
TreeView+ depends on / blocked
 
Reported: 2010-07-30 11:49 UTC by Vishal Gaikwad
Modified: 2018-12-05 15:15 UTC (History)
4 users (show)

Fixed In Version: spacewalk-proxy-0.5.7-15.el4sat
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-10-28 15:01:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
How was reproduced. (1.85 KB, application/x-sh)
2010-09-21 11:55 UTC, Dimitar Yordanov
no flags Details

Description Vishal Gaikwad 2010-07-30 11:49:45 UTC
Description of problem:
API script that logs in to Satellite through an RHN Proxy returns errors.After successful authentication, the system.custominfo.listAllKeys method is called, but it returns 0-length content ("header: Content-Length: 0"). This causes the connection to error out with "xml.parsers.expat.ExpatError: no element found: line 1, column 0". No errors found in Satellite-side logs. 
Version-Release number of selected component (if applicable):

# cat api-2036900.py 
#!/usr/bin/python

import xmlrpclib
sat = xmlrpclib.Server('http://rhn-proxy-fqdn/rpc/api', verbose=1)
key = sat.auth.login('xxxxx', 'xxxxx')
allkeys = sat.system.custominfo.listAllKeys(key)
for a in allkeys:
        print "%s" % (a['id'])

[root@dhcp242-204 ~]# python api-2036900.py 
connect: (xxxxxxxx, 80)
send: 'POST /rpc/api HTTP/1.0\r\nHost: dhcp242-204\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 215\r\n\r\n'
send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>auth.login</methodName>\n<params>\n<param>\n<value><string>admin</string></value>\n</param>\n<param>\n<value><string>redhat</string></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Fri, 30 Jul 2010 10:50:41 GMT
header: Server: Apache/2.2.3 (Red Hat)
header: set-cookie: JSESSIONID=BD903724E89393575B84E2DA387DA8DD; Path=/rhn; Secure
header: content-length: 174
header: content-type: text/xml
header: Connection: close
body: '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><string>121278xc423ff8b1318e0eec790676e406eb437</string></value></param></params></methodResponse>'
connect: (xxxxxxxx, 80)
send: 'POST /rpc/api HTTP/1.0\r\nHost: dhcp242-204\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 212\r\n\r\n'
send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>system.custominfo.listAllKeys</methodName>\n<params>\n<param>\n<value><string>121278xc423ff8b1318e0eec790676e406eb437</string></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Fri, 30 Jul 2010 10:50:41 GMT
header: Server: Apache/2.2.3 (Red Hat)
header: set-cookie: JSESSIONID=ADB3126AA19053C25F4671F35A59D733; Path=/rhn; Secure
header: transfer-encoding: chunked
header: content-type: text/xml
header: Content-Length: 0
header: Connection: close
Traceback (most recent call last):
  File "api-2036900.py", line 7, in ?
    allkeys = sat.system.custominfo.listAllKeys(key)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1284, in _parse_response
    p.close()
  File "/usr/lib/python2.4/xmlrpclib.py", line 530, in close
    self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0

How reproducible:
Always

Steps to Reproduce:
1. Create Custom System Info Keys from the WebUI
2. Populate it.
3. Use the above API and let it go through a RHN Proxy Server
  
Actual results:
xml.parsers.expat.ExpatError: no element found: line 1, column 0

Expected results:
Should list all the Custom System Info Keys and it's contents

Additional info:
The same script does not encounter any errors when modified to log in directly to the Satellite.

Comment 10 Tomas Lestach 2010-08-30 09:36:14 UTC
After consultation with Justin, this looks more like a RHN Proxy bug.
After checking proxy code, I found out, this issue shall already have been resolved by following commit: 73dbab3dc8f362c1280b381ffb508a67c96ff3e0 (part of BZ#578854).

Comment 14 Dimitar Yordanov 2010-09-21 11:55:27 UTC
Created attachment 448680 [details]
How was reproduced.

Comment 15 Dimitar Yordanov 2010-09-21 11:57:11 UTC
 
 I have just manage to reproduce and verify the issue on RHEL 5, RHN Proxy 5.3.
 For more info see attachment.
Dimi

Comment 16 Michael Mráka 2010-10-27 13:10:55 UTC
Verified in stage.

Created 4 custom info keys with very long (more then 1kB) description and run
#!/usr/bin/python
import xmlrpclib
sat = xmlrpclib.Server('http://smqe-ws16.lab.eng.brq.redhat.com/rpc/api', verbose=1)
key = sat.auth.login('admin', 'password')
allkeys = sat.system.custominfo.listAllKeys(key)
for a in allkeys:
        print "%s" % (a['id'])


Also run
#!/usr/bin/python
import xmlrpclib
sat = xmlrpclib.Server('http://smqe-ws16.lab.eng.brq.redhat.com/rpc/api', verbose=1)
key = sat.auth.login('admin', 'admin')
allkeys = sat.system.listSystems(key)
for a in allkeys:
        print "%s" % (a['id'])
        print sat.system.listPackages(key, a['id'])

Both scripts worked and showed that response had transfer-encoding: chunked.

Comment 17 Clifford Perry 2010-10-28 14:56:23 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford


Note You need to log in before you can comment on or make changes to this bug.