Modifying adapter sample is not working

Asked by Lucian Bazoi

  I'm playing with modifying adapter sample but it's not working. The very small content doesn't get through. I even commented the adaptContent(chunk) call but it still doesn't get through. Do I need to patch it based on the open bug reports here on lp?
  The passthru adapter sample works ok.
  I can see debugging messages inserted.
  Do you have any idea why modifying adapter isn't working?
  I am using squid 3.1.8 in a reverse proxy setup.

Thank you.

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Lucian Bazoi (dezvoltator) said :
#1

Adding abort() in Adapter::Xaction::start() causes Squid server to stop functioning. The squid processes are still there but squid is not working properly.

Revision history for this message
Alex Rousskov (rousskov) said :
#2

There are no open bug reports on lp that require patching v0.0.3 of the libecap library or adapter samples.

Does the modifying adapter receive the "very small content" from the host application (Squid in your case)?

Does the modifying adapter send the "very small content" back to the host application (Squid in your case)?

You can add debugging messages to check that the expected content is received and sent back.

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#3

Hi Alex,
  The modifying adapter receives the content from the Squid -host application.
  Squid proxy receives the content back from the modifying adapter. I see it in Ecap::XactionRep::noteAbContentAvailable()

  Using passthru adapter the content is getting in my jsp web page,
  Using modifying adapter the content is not getting in my jsp web page.

Thank you,
Lucian

Revision history for this message
Alex Rousskov (rousskov) said :
#4

It sounds like Squid does not understand that no more content is expected or is otherwise confused about the body state. Does the server receive any part of the adapted request body at all? Does it get request headers?

Can you post a link to cache log with full debugging enabled while processing a single problematic HTTP transaction? I know you have posted similar log in the past, but you assessment of the situation has changed so perhaps it is best if you can post fresh results.

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#5

Hi Alex,

   I think the server receives the entire adapted request body and headers too.
Here's a link to cache log.
  http://www.easy-share.com/1913484463/cache.log
It is a free server so I couldn't get rid of the 20 seconds wait.

In the adapter in Xaction::noteVbContentAvailable()
   sendingAb == opOn so the host gets notified hostx->noteAbContentAvailable();

  In the jsp page i have a test that if parameter txtName != null then it prints something. So I guess the parameter is null.

Thank you.

Revision history for this message
Alex Rousskov (rousskov) said :
#6

If the server receives the entire adapted request, what is the problem you are trying to solve? Initially you said that something "does not get through". Later you said "the content is not getting to my jsp web page". Are you saying that the entire adapted request reaches your script but it is not the request you expect?

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#7

The problem is that the content submitted from a web page doesn't get back in the web page when using ecap modifying adapter.
The content of a text area should be written in the jsp web page like it does when using the passthru adapter.
Initially I said that content did not get through the ecap modifying adapter.
Later I discovered that the entire modified content is coming back in the Squid server but nothing comes in the web page.

I have a simple "request.getParameter("txtName") " written in the page.

Thank you.

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#8

No content reaches the script when using ecap modifying adapter, though I see the entire adapted request getting back from ecap adapter to squid proxy server.

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#9

The problem persists in ecap library and ecap modifying adapter v0.1.0

Revision history for this message
Alex Rousskov (rousskov) said :
#10

What Squid version are you using with ecap library and ecap modifying adapter v0.1.0?

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#11

It is Squid v3.1.10

Revision history for this message
Alex Rousskov (rousskov) said :
#12

AFAICT, the log you posted (http://www.easy-share.com/1913484463/cache.log) shows the request body adaptation is happening and also shows that Squid sends adapted content buffer to the origin server as expected. I cannot see anything wrong in that log, but that does not mean there are no problems, of course.

Instead of relying on some server-side scripts to tell you what is received, can you capture HTTP/TCP packets as they enter and leave Squid? You can use wireshark or tcpdump to capture packets. Such a capture will show us exactly what is sent to Squid and what is forwarded to the origin server, even if the request gets corrupted by Squid in some way.

Revision history for this message
Alex Rousskov (rousskov) said :
#13

Squid v3.1.10 does not support libecap v0.1.0. Keep using libecap v0.0.x with Squid v3.1.10.

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#14

What squid version supports libecap v0.1.0?
10q

Revision history for this message
Alex Rousskov (rousskov) said :
#15

No official Squid release supports libecap v0.1.0 at this time. See release announcement at https://launchpad.net/ecap/+announcement/7558 for other options.

Revision history for this message
Alex Rousskov (rousskov) said :
#16

Squid debugging log looked normal. Need before/after-Squid HTTP/TCP packet captures to confirm the existence of an eCAP-related problem.

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#17

Hi Alex,
  I'm sending you tcpdump capture

  I'm using libecap v0.1.0 with squid 3p2-ecap. Squid started in no-daemon mode
  When Squid is set up with minimal adapter for reqmod and with modifying adapter for respmod it seems to work, the text entered in the text area comes back (modified) in the web page.

   When having the below section in squid.conf the text doesn't come back at all in the webpage (3p2-ecap squid with ecap v0.1.0), the same happens when using squid 3.1.10 with libecap v0.0.3 with adapters 0.0.3 in any combination.
# e-cap
ecap_enable on
loadable_modules /usr/local/lib/ecap_adapter_modifying.so /usr/local/lib/ecap_adapter_minimal.so
ecap_service eReqmod reqmod_precache 0 victim=the replacement=zau ecap://e-cap.org/ecap/services/sample/modifying
ecap_service eRespmod respmod_precache 0 ecap://e-cap.org/ecap/services/sample/minimal
adaptation_service_set reqFilter eReqmod
adaptation_service_set respFilter eRespmod
adaptation_access respFilter allow all
adaptation_access reqFilter allow all

This is what I need, to inspect the request and possibly reject the request.
Using this ecap configuration and entering text in text area and submitting 3 times I got this output using tcpdump
http://www.easy-share.com/1913631137/output

Thank you

Revision history for this message
Alex Rousskov (rousskov) said :
#18

You have posted tcpdump packet summary. It does not contain any information about HTTP payload. You need to capture packets themselves. Add "-s 0 -w output.cap" to your tcpdump options and make sure output.cap contains "tcpdump capture file" and not "ASCII text". For example,

$ file myoutput.cap
myoutput.cap: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 65535)

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#19

I made a packets capture containing "tcpdump capture file" and I read that capture in this file

http://www.easy-share.com/1913631611/outputdetail

Thank you

Revision history for this message
Alex Rousskov (rousskov) said :
#20

outputdetail is the same useless ASCII summary. I am asking for the packet capture file itself (output.cap in my example).

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#21

the capture contains no more info than what I posted.

tcpdump -s 0 -w output.pcap -vvv -XX \( host ip1 or host ip2 \)

should I add/remove options from the command?
Tnak you

Revision history for this message
Alex Rousskov (rousskov) said :
#22

You need to post output.pcap file produced by tcpdump, not the tcpdump console messages. That output.pcap file contains HTTP/TCP packets. tcpdump console messages (the output and outputdetail files you posted) contains high-level summary of captured packets, which is useless in this case.

Revision history for this message
Lucian Bazoi (dezvoltator) said :
#23

Is this a correct ecap congifuration for modifying the request?

# e-cap
ecap_enable on
loadable_modules /usr/local/lib/ecap_adapter_modifying.so /usr/local/lib/ecap_adapter_minimal.so
ecap_service eReqmod reqmod_precache 0 victim=the replacement=zau ecap://e-cap.org/ecap/services/sample/modifying
ecap_service eRespmod respmod_precache 0 ecap://e-cap.org/ecap/services/sample/minimal
adaptation_service_set reqFilter eReqmod
adaptation_service_set respFilter eRespmod
adaptation_access respFilter allow all
adaptation_access reqFilter allow all

Thanks.

Revision history for this message
Alex Rousskov (rousskov) said :
#24

Looks OK to me, provided you are using Squid 3p2-ecap and v0.1.0 adapter sample.

You do not need RESPMOD-related entries for REQMOD to work, of course. IIRC, the adaptation_service_set is also optional if there is only one service in the set.

Can you help with this problem?

Provide an answer of your own, or ask Lucian Bazoi for more information if necessary.

To post a message you must log in.