Roundup Tracker - Issues

Message7404

Author schlatterbeck
Recipients rouilj, schlatterbeck
Date 2021-12-07.15:53:55
Message-id <20211207155349.mz6kgvfevhjht36e@runtux.com>
In-reply-to <20211207151806.842326A0192@pe15.cs.umb.edu>
On Tue, Dec 07, 2021 at 03:18:11PM +0000, John Rouillard wrote:
> 
> >John, would you agree that setting these headers to '' instead of
> >None would still fulfill the original intention? I've tested this
> >will not produce a traceback.
> 
> According to what I remember, these headers should not be emitted at
> all.
> 
> Does this change to client.py solve the issue?

Hmm, can't test immediately: This is a "production" (sort-of) system
I'm ham-radio operator and I'm keeping my logs in a roundup tracker.
There are external QSL services (QSL is a report to another ham for a
successful connection called a QSO) from which I'm downloading QSL-Cards
(a picture with some text on it) and attach this to the QSL in Roundup.

The thing fails *after* the picture has been sucessfully created in
Roundup but *before* the QSL item is modified to include the Link to the
picture.

So this isn't the typical json request but a file upload with another
content-type.

>      def setHeader(self, header, value):
> -        """Override a header to be returned to the user's browser.
> +        """Override or delete a header to be returned to the user's browser.
>          """
> -        self.additional_headers[header] = value
> +        if value is None:
> +            try:
> +                del(self.additional_headers[header])
> +            except KeyError:
> +                pass
> +        else:
> +            self.additional_headers[header] = value

On inspection that patch looks like it should work.
Feel free to commit & push and I'll close the issue if it works for me
or tell you when I download pictures next time ;-)

> Also shouldn't test*Post*() in test/rest_common.py have shown the
> issue? Since this appears unique to wsgi, I wonder if a file POST test
> case test_liveserver.py can trigger it.

If that test checks for file-uploads, yes. But I doubt it does (haven't
looked).

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com
History
Date User Action Args
2021-12-07 15:53:56schlatterbecksetrecipients: + schlatterbeck, rouilj
2021-12-07 15:53:56schlatterbecklinkissue2551178 messages
2021-12-07 15:53:55schlatterbeckcreate