RE: adding content to the cache

From: <anita.sivakumar_at_wipro.com>
Date: Tue, 8 May 2012 05:11:28 +0000

Hi Alex,

I tried the following request but it returned saying it is an invalid request.

In Foo:
PUT http://myserver/file1.html HTTP/1.1
HOST:localhost
Accept:*/*
Content-Type:text/html

Where file1.html is present in myserver (apache).

I get the error as:
HTTP/1.0 400 Bad Request
Server: squid/3.1.16
Mime-Version: 1.0
Date: Tue, 08 May 2012 10:29:51 GMT
Content-Type: text/html
Content-Length: 3192
X-Squid-Error: ERR_INVALID_URL 0
Vary: Accept-Language
Content-Language: en
X-Cache: MISS from squid.packet-pushers.net
Via: 1.0 squid.packet-pushers.net (squid/3.1.16)
Connection: close

Am I missing something in how to write a PUT request?

Thanks.

Regards,
Anita

-----Original Message-----
From: Alex Rousskov [mailto:rousskov_at_measurement-factory.com]
Sent: 07 May 2012 21:19
To: Anita Sivakumar (WT01 - GMT-Telecom Equipment)
Cc: squid-dev_at_squid-cache.org
Subject: Re: adding content to the cache

On 05/07/2012 05:35 AM, anita wrote:
>> It sends an HTTP PUT request to Squid and reads the response. The PUT
>> request body is taken from the named file. You most likely do not need
>> this because you want to GET content from the fake server, and not PUT
>> content to the fake server. Squid does not cache request bodies.

> Just came across this post. Wondering how to use this feature for
> squidclient.
> Can we simply do a squidclient -P http://server/filename.html ?
> Where the filename.html is the actual object that I would need to be pushed
> into the squid cache?

IIRC, "squidclient -P Foo" specifies that the PUT request body should
come from a file named Foo. Squid does not cache request bodies.

Squid caches responses. If you want Squid to cache the contents of file
Foo, you have to make Foo available on some web server. It is relatively
easy to set up a "fake" server that responds with Foo to all HTTP
requests (and runs on the same host as Squid), but you can also use
Apache httpd or another full-blown origin server.

With Rock Store (v3.2 and up), it is also possible to add something to
the Squid disk cache without using HTTP (because the cache index and
queues are stored in shared memory accessible to any process with enough
permissions). However, the above approach with a fake server is easier
if you just want to cache a single file.

Please note that I do not really understand all the complexities of the
overall problem you are trying to solve (the description of the problem
that you posted earlier was too convoluted for me) so I cannot recommend
a good solution or evaluate whether the above is the right path towards
that solution. I am just trying to answer a specific question instead.

HTH,

Alex.

Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
Received on Tue May 08 2012 - 05:11:38 MDT

This archive was generated by hypermail 2.2.0 : Tue May 08 2012 - 12:00:10 MDT