Bug 604167

Summary: wget of packages from WebUI via RHN Proxy returns 0 bytes RPM package
Product: [Community] Spacewalk Reporter: Miroslav Suchý <msuchy>
Component: ServerAssignee: Miroslav Suchý <msuchy>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: high    
Version: 1.1CC: tlestach, vgaikwad
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 602591 Environment:
Last Closed: 2010-08-19 08:24:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 585232, 602591    

Description Miroslav Suchý 2010-06-15 14:37:30 UTC
+++ This bug was initially created as a clone of Bug #602591 +++

Description of problem:
wget RPM from client to RHN Satellite via RHN Proxy returns 0 byte file

Version-Release number of selected component (if applicable):
RHN Proxy 530

How reproducible:
Always

Steps to Reproduce:
1. Setup a RHN Proxy 5.3 connected to RHN Satellite 530
2. From the Satellite WebUI, click Channels -> Packages -> Select any package's download link
3. Replace the RHN Satellite's FQDN with RHN Proxy's FQDN
4. wget http://rhn-proxy-fqdn/download/package/92ae189222b8301fb35a07d1ba393ff67517a713/1276023102650/1/14044/acpid-1.0.4-5.i386.rpm

Actual results:

-rw-rw-r-- 1 xxxx xxxx        0 2010-06-10 12:46 acpid-1.0.4-5.i386.rpm

A zero byte rpm package

Expected results:
Full/actual size of the RPM package

Additional info:
A wget of the same package using RHN Satellite's FQDN works fine.

--- Additional comment from msuchy on 2010-06-15 08:47:54 EDT ---

Problem is in:
2010/06/15 08:14:08 -04:00 2840 127.0.0.1: proxy/rhnShared._forwardServer2Client
2010/06/15 08:14:08 -04:00 2840 127.0.0.1: proxy/rhnShared._determineHTTPBodySize('headers: ', [('transfer-encoding', 'chunked'), ('set-cookie', 'JSESSIONID=8A60B7AA0C6FE2019F25949F394F0CEF; Path=/rhn; Secure'), ('keep-alive', 'timeout=15, max=400'), ('connection', 'Keep-Alive'), ('date', 'Tue, 15 Jun 2010 12:13:00 GMT'), ('content-type', 'application/octet-stream;charset=UTF-8')])
2010/06/15 08:14:08 -04:00 2840 127.0.0.1: proxy/rhnShared._forwardHTTPBody('Response body size: ', 0)
2010/06/15 08:14:08 -04:00 2840 127.0.0.1: proxy/apacheHandler.handler('Leaving with status code 0',)


where _forwardHTTPBody forward 0 bytes of body.
This is due missing content lenght in response from satellite:

$ GET -sSed http://morbo.rdu.redhat.com/download/package/11bad99a0e3360de514e17b3d818b01152999f13/1276639949993/1/38976/kmod-kvm-83-105.el5_4.27.x86_64.rpm
GET http://morbo.rdu.redhat.com/download/package/11bad99a0e3360de514e17b3d818b01152999f13/1276639949993/1/38976/kmod-kvm-83-105.el5_4.27.x86_64.rpm --> 200 OK
Connection: close
Date: Tue, 15 Jun 2010 12:19:02 GMT
Content-Type: application/octet-stream;charset=UTF-8
Client-Date: Tue, 15 Jun 2010 12:19:04 GMT
Client-Peer: 10.11.242.126:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Set-Cookie: JSESSIONID=5E5E363195FB04E8D4BFC058EE8EDAEE; Path=/rhn

Note that even with fix from 
https://bugzilla.redhat.com/show_bug.cgi?id=578854#c2
it did not work. The data however get from rhnRedirect to squid, but squid thinks:
2010/06/15 08:36:01| Oversized chunk header on port 33548, url http://127.0.0.1/download/package/bcdb679c2b84b60f43fb147546dae17fcfb49d71/1276641267091/1/38906/kmod-kvm-83-105.el5.x86_64.rpm
and immediately release the data from cache. And rhnBroker will not forward those data anyway (reason is still unknown to me).

But correct fix should be to send Content-Length from Satellite server.

--- Additional comment from msuchy on 2010-06-15 08:53:19 EDT ---

RHN Sat 5.2 do send Content-Length header. Setting Reggression flag

$ GET -sSed http://rlx-1-06.rhndev.redhat.com/download/1276606894/824bfaa2f839c780a660f54415d8b46a930c08d6/1/0/redhat/NULL/a2ps/4.13b-57.1.el5/ia64/a2ps-4.13b-57.1.el5.ia64.rpm
GET http://rlx-1-06.rhndev.redhat.com/download/1276606894/824bfaa2f839c780a660f54415d8b46a930c08d6/1/0/redhat/NULL/a2ps/4.13b-57.1.el5/ia64/a2ps-4.13b-57.1.el5.ia64.rpm --> 200 OK
Cache-Control: no-cache
Connection: close
Date: Tue, 15 Jun 2010 12:51:45 GMT
Pragma: no-cache
Server: Apache/2.2.3 (Red Hat)
Content-Length: 1368525
Content-Type: application/octet-stream
Expires: Tue, 15 Jun 2010 12:51:45 GMT
Client-Date: Tue, 15 Jun 2010 12:51:50 GMT
Client-Peer: 10.10.76.153:80
Client-Response-Num: 1
Content-Disposition: attachment; filename=a2ps-4.13b-57.1.el5.ia64.rpm

--- Additional comment from msuchy on 2010-06-15 08:57:21 EDT ---

This url is rewriten using:
zz-spacewalk-www.conf:RewriteRule ^/download/(.*)$ /rhn/common/DownloadFile.do?url=$1 [P]

--- Additional comment from tlestach on 2010-06-15 10:26:26 EDT ---

Adding "Content-Length" to response header for different download contents

spacewalk.git: a66747190151e01e482b30e7d627f7f833947f70

Comment 1 Milan Zázrivec 2010-08-19 08:24:14 UTC
Spacewalk 1.1 has been released.